1 Reply Latest reply on Jan 18, 2010 2:39 PM by Bad Prop Gun Productions

    Flash FLV Player (XML Driven) works locally, not online

    Bad Prop Gun Productions

      I have been beating my head into the walls on this one.

       

      I have an actions layer and a layer with a video object, called "theVideo". Below is the actionscript:

       

      stop();

      // global objects....

      buffer._visible = false;

      // playlist object for the playlist from raw xml data

      var playlistData:Object = new Object();

      playlistData.list = new Array();

       

      // Create a videos object to hold a video

      var videos:Object = new Object();

       

      // create variable for keeping count of videos played

      var hasPlayed:Object = new Object();

       

      // create variable for tracking buffer

      var hasBuffered:Object = new Object();

       

      // create variable for total movies to be played

      var quantity:Object = new Object();

       

      function loadXML(loaded) {

        if (loaded) {

          xmlNode = this.firstChild;

          total = xmlNode.childNodes.length;

          for (i=0; i<total; i++) {

            playlistData.list[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;

            descriptions.list[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;

          }

          trace ("Loaded "+total+" entries from XML source.");

        } else {

          content = "file not loaded!";

        }

      trace("Trying to start vids...");

      hasplayed = 0;

      hasBuffered = 0;

      startVids();

      }

       

      xmlData = new XML();

      xmlData.ignoreWhite = true;

      xmlData.onLoad = loadXML;

      var myChannel:String = _level0.channel;

      var myEpisode:String = _level0.episode;

      //var myXmlFile:String = "xml.php?channel=0&episode=0";

      var myXmlFile:String = "xml.xml";

      xmlData.load(myXmlFile);

       

      function startVids() {

        trace("Made it to start vids. Making a new connection...");

      // Create a NetConnection object:

        var nc:NetConnection = new NetConnection();

        trace("Net connection to null...");

      // Create a local streaming connection:

        nc.connect(null);

        trace("New netstream connection...");

      // Create a NetStream object and define an onStatus() function:

        var ns:NetStream = new NetStream(nc);

        trace("Set the time to buffer");

      // Set the buffer time:

        ns.setBufferTime(5);

        trace("Attching netstream to instance of video");

      // Attach the NetStream video feed to the Video object:

        theVideo.attachVideo(ns);

       

        theVideo.addEventListener("complete",nsListener);

       

        ns.onStatus = function(info) {

        if(info.code == "NetStream.Buffer.Full") {

      // Do Nothing (used for buffer message later)

        }

        if(info.code == "NetStream.Buffer.Empty") {

      // Do Nothing (used for buffer message later)

        }

        if(info.code == "NetStream.Play.Stop") {

          loadNext();

        }

      }

       

      trace("Play the first video in the lineup, which is "+playlistData.list[0]);

      // Being playing the FLV file:

      ns.play(playlistData.list[hasplayed]);

      trace("Set hasplayed to 1");

      // hasplayed++;

      trace("Get quantity, which is "+playlistData.list.length);

      quantity = playlistData.list.length;

       

      nsListener.complete = function( evt:Object ):Void {

          loadNext();

      };

       

       

      }

       

      function loadNext() {

        if(hasplayed < quantity) {

          clearInterval(myInt);

           hasplayed += 1;

           startVids();

      } else {

           ns.close();

      }

      }

       

      ************************END ACTIONSCRIPT*************************

       

      This script works locally. I have checked and double-checked the file locations when uploaded. It will parse the XML file when uploaded, but will not play the videos.

       

      Many, MANY thanks in advance.