This is my first attempt at building a dynamic playlist for streaming flash
video and I'm following the tutorial at
"macromedia.com/devnet/flash/articles/video_player.html". I've changed the
paths to my FMS and loaded the video files to the applications directory of the
FMS (flash_applications/videosource). The thumbnails load and the player skin
loads but the videos do not load when I click on the thumbnails.
I've read the earlier post about this same issue. I followed the advice from
that post and reloaded the 'main.asc' file from my Flash 8 program files but
the video still does not play.
Here is a link to the site so you can see the problem:
http://media.us.elsevierhealth.com/videosource/VideoSource1.swf
My FMS is 'media.us.elsevierhealth.com'
I believe my code is correct and I believe the paths I've created are correct.
If someone could review my code and check the path info I would appreciate it.
Here is the code from 'VideoSource1.as'
********************************************************************************
******
import mx.video.*;
//Set up the list box, call function VideoThumb to create the actual thumbnails
list.rowHeight = 70;
list.cellRenderer = "VideoThumb";
list.selectable = true;
//create new empty listener object
listListener = {};
nc = new NetConnection(); //create a connection
nc.connect("rtmp://media.us.elsevierhealth.com/videosource"); //connect to
FCS (nav.attributes.url)
ns = new NetStream(nc); //create a stream
ns.connect(); //connect the stream
nc.connect("rtmp://media.us.elsevierhealth.com/videosource");
var stream_ns:NetStream = new NetStream(nc);
stream_ns.play("video2.flv");
// Create function to trace all the status info.
function traceStatus(info) {
Message.text+="Level: " + info.level + " Code: " + info.code+"\n";
} // Assign this function to onStatus handlers when you create objects.
//Function to handle what happens when an item in the list is selected
listListener.change = function( evtobj ) {
var nav = list.dataProvider;
var reset = true;
for ( var i = 0; i < nav.childNodes.length; i++ ) {
var stream = nav.childNodes;
if ( stream.nodeName == "stream" ) {
attachMovie("FLVPlayback", "my_FLVPlybk", 10, {width:320, height:240, x:90,
y:100});
//center the FLVPlayback component when FLV is ready to play
var listenerObject:Object = new Object();
listenerObject.resize = function(eventObject:Object):Void {
//center video in playback area
newx = (460 - my_FLVPlybk.preferredWidth)/2;
newy = (470 - my_FLVPlybk.preferredHeight)/2;
my_FLVPlybk._x = newx;
my_FLVPlybk._y = newy;
};
my_FLVPlybk.addEventListener("resize", listenerObject);
listenerObject.ready = function(eventObject:Object):Void {
my_FLVPlybk.setSize(250, 350);
};
my_FLVPlybk.skin = "ClearExternalAll.swf";
my_FLVPlybk.clear();
my_FLVPlybk.contentPath =
"rtmp://media.us.elsevierhealth.com/videosource/stream/_definst_/" +
stream.attributes.name+".flv";
my_FLVPlybk.autoSize = true;
trace(my_FLVPlybk.contentPath);
reset = false;
}
}
}
//Add an event listener on the list, when it triggers, run the listListener
function to repopulate the list
list.addEventListener("change", listListener);
//Function that loads the XML file, parses it, and builds the list of
available video clips
var xmllist = new XML(); //setup a variable to hold the XML
xmllist.ignoreWhite = true;
xmllist.load( "playlist-demo-1.xml" ); //load the XML file
//The following gets called when the XML has been loaded
xmllist.onLoad = function( status ) {
if ( !status )
trace( status );
var entries = this.childNodes;
var playlists = {};
var nav = ;
for ( var i = 0; i < entries.childNodes.length; i++ ) {
var entry = entries.childNodes;
if ( entry.nodeName == "listitem" )
//builds array of video clip names
playlists = entry;
else if ( entry.nodeName == "menu" ) {
//builds array of available videos
for ( var j = 0; j < entry.childNodes.length; j++ )
nav = playlists.attributes.name];
} //end else if
} //end if
//sends the array of videos to the listbox UI
list.dataProvider = nav;
} //end xmllist.onload
********************************************************************************
***
Any advice or troubleshooting will be appreciated. Thanks in advance.