Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Adding Visible playlist to an embedded FLV Player

13 replies [Last post]

Can someone help me troubleshoot the code for this issue? I am trying to embed the FLV player, and show a playlist that users can select the video they want to play

The code below works in that it displays the payer, and plays the playlist, but it plays the videos one after the other without stopping and never displays the playlist.

Embedded code

<script type="text/javascript" src="http://domain/static/mediaplayer/current/swfobject.js"></script>
<div id="flashvideo">this will be replaced by the SWF.</div>
<script type="text/javascript">
var so = new SWFObject('http://domain/static/mediaplayer/current/mediaplayer.swf','playlist','640','480','9');
so.addParam('allowfullscreen','true');
so.addParam('width', '640');
so.addParam('height', '480');
so.addParam('displaywidth', '320');
so.addParam('displayheight', '240');
so.addParam('flashvars','file=http://domain/c/document_library/get_file%3Fp_l_id%3D147022%26folderId%3D16415%26name%3DDLFE-10817.x...');
so.write('flashvideo');
</script>

--------------------------------------------------------------------------------

Playlist
<?xml version='1.0' encoding='UTF-8' ?>
<playlist version='1' xmlns='http://xspf.org/ns/0/'>
<trackList>
<track>
<creator>Minny Mouse</creator>
<title>Session 1</title>
<location>http://domain/static/mediaplayer/current/video.flv</location>
<image>http://domain/image/image_gallery%3Fimg_id=134601</image>
<info>http://domain/</info>
</track>
<track>
<creator>Mickey Mouse</creator>
<title>Session 1</title>
<location>http://otherdomain/flash/global/CDNPortal/devconf2008_session_1.flv</location>
<image>http://domain/image/image_gallery%3Fimg_id=134601</image>
<info>http://domain/</info>
</track>
<track>
<creator>Donald Duck</creator>
<title>Session 2</title>
<location>http://otherdomain/flash/global/CDNPortal/devconf2008_session_1.flv</location>
<image>http://domain/image/image_gallery%3Fimg_id=134601</image>
<info>http://domain/</info>
</track>
</trackList>
</playlist>

Put these four flashvars (NOT parameters) into your flashvars.

so.addParam('width', '640');
so.addParam('height', '480');
so.addParam('displaywidth', '320');
so.addParam('displayheight', '240');

Please review the supported flashvars here: http://code.longtailvideo.com/trac/wiki/Flashvars3

Thanks, this makes things cleaner I think, but still no playlist showing yet. :-(

It's not very clear to me.

Post your current code.

I got it to work showing the playlist, thanks. I cannot stop it from playing all of the files one after the other. Is there a setting that will not automatically play all files in list?

repeat (false): Set this to true to automatically repeat playback of all files. Set this to list to playback an entire playlist once.

Now none of the files will play. the images show, the playlist is perfect, but the videos just spin as if they are buffering.

EMBED CODE-----------------------------------

<script type="text/javascript" src="http://mydomain/static/mediaplayer/current/swfobject.js"></script>
<div id="flashvideo">replaced by the SWF.</div>
<script type="text/javascript">
var so = new SWFObject('http://mydomain/static/mediaplayer/current/mediaplayer.swf','playlist','640','680','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');
so.addParam('flashvars','file=http://mydomain/c/document_library/get_file%3Fp_l_id%3D147022%26folderId%3D16415%26name%3DDLFE-10817...');
so.write('flashvideo');
</script>

XML PLAYLIST ---------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8' ?>
<playlist version='1' xmlns='http://xspf.org/ns/0/'>
<trackList>
<track>
<creator>John Smith, Director of Engineering</creator>
<title>Welcome, Release 2.5 Overview and Demo </title>
<location>http://videosdomain/flash/global/Portal/session_1.flv</location>
<image>http://mydomain/image/image_gallery?img_id=134601</image>
<info>http://mydomain/web/cuae/devconf2008/</info>
</track>
</trackList>
</playlist>

You are trying to use v4.x player flashvars with a v3.x player.

so.addParam('flashvars','file=http://mydomain/c/document_library/get_file%3Fp_l_id%3D147022%26folderId%3D16415%26name%3DDLFE-10817.xml&autostart=false&thumbsinplaylist=true&<strong>playlist=top</strong>&displayheight=480&autoscroll=true&repeat=false');

Please review the v3.x flashvars on this page: http://code.longtailvideo.com/trac/wiki/Flashvars3 and make sure that you only use supported flashvars.

then perhaps an upgrade is in order

Switched to version 4 of the FLV player - Still cannot get files to play although the playlist looks even better now.

<script type="text/javascript" src="http://mydomain/static/mediaplayer/current/swfobject.js"></script>
<div id="flashvideo">replaced by the SWF.</div>
<script type="text/javascript">
var so = new SWFObject('http://mydomain/static/mediaplayer/current/player.swf','playlist','640','680','9');
so.addParam('flashvars','file=http://mydomain/c/document_library/get_file%3Fp_l_id%3D147022%26folderId%3D16415%26
name%3DDLFE-10817.xml&fullscreen=true&playlist=bottom&playlistsize=180&repeat=false');
so.write('flashvideo');
</script>

Your code looks OK. Can you load the URI for the playlist in your browser and get a validated playlist back?

When you have the special characters ( ? = & ) in your URI, it's a lot easier to let JavaScript do the urlencoding for you:

<script type="text/javascript" src="http://mydomain/static/mediaplayer/current/swfobject.js"></script>

<div id="flashvideo">replaced by the SWF.</div>

<script type="text/javascript">
  var so = new SWFObject('http://mydomain/static/mediaplayer/current/player.swf', 'playlist', '640', '680', '9');
      so.addParam('flashvars',  'fullscreen=true&playlist=bottom&playlistsize=180&repeat=<strong>none</strong>');
<strong>      so.addVariable('file',     encodeURIComponent('http://mydomain/c/document_library/get_file?p_l_id=147022&folderId=16415&name=DLFE-10817.xml'));</strong>
      so.write('flashvideo');
</script>

For the v4.x player, repeat is:

repeat (none): set to list to play the entire playlist once and to always to continously play the song/video/playlist.

Now that you're using the v4.x player, check the skinning at: http://www.jeroenwijering.com/?item=Skinning_the_JW_Player There's a link on that page to the available skins at longtail.

I could not use the encodeURIComponent for some reason. However, I did get it to work now. Thanks for your help.

Now to move to the .wmv player.

@Jim,

You're welcome. Good luck with the WMV player.