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

Forums

/

big Trouble with the longtail player playlist

1 reply [Last post]

Hey,

Sorry for my english but i'm french

So i have a website with 1000 visits each day, who speak about electronic music.

There is a player with the last 30 songs.

I have a lot of problem with the longtail player

1) When i call a music with the link

href="javascript:loadFile('playerxml.php?idmusique=340')"

its call the last song i've heard (the new song isn't load)

2) The music doesn't continue at the end (i lost for each music 30sec)

3) Some music has 6 sec duration

I give you the JS, XML, HTML code :

XML

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>Playlistr</title>
<link>url</link>

<item>
<title>International Autoradio</title>
<media:content url="url1" type="audio/mp3"/>
<media:thumbnail url="urlimage1" />
<description>WAT feat Cs Rucker</description>
</item>
<item>
<title>Come On</title>
<media:content url="url2" type="audio/mp3"/>
<media:thumbnail url="urlimage2" />
<description>Nasser</description>

</item>
</channel>
</rss>

JS code

var currentPlaylist = null;
var currentItem = -1;
var previousItem = -1;

var player = null;
function playerReady(thePlayer) {
player = window.document[thePlayer.id];
addListeners();
}

function getPlaylistData() {
var plst = null;
plst = player.getPlaylist();

if (plst) {
currentPlaylist = plst;

var txt = '';
for(var i in currentPlaylist) {
txt += '<input type="checkbox" id="cb' + i + '" checked="checked" />   ';
txt += currentPlaylist[i].title;
txt += '<br />';
}
var tmp = document.getElementById("plstDat");
if (tmp) { tmp.innerHTML = txt; }
}
}

function addListeners() {
if (player) {
player.addControllerListener("ITEM", "itemListener");
player.addControllerListener("MUTE", "muteListener");

player.addModelListener("LOADED", "loadedListener");
player.addModelListener("STATE", "stateListener");
player.addModelListener("TIME", "positionListener");

player.addViewListener("VOLUME", "volumeListener");
} else {
setTimeout("addListeners()",100);
}
}

function itemListener(obj) {
if (obj.index != currentItem) {
previousItem = currentItem;
currentItem = obj.index;

if (previousItem == -1) { getPlaylistData(); }

var tmp = document.getElementById("itm");
if (tmp) {
tmp.innerHTML = "current item: " + currentItem +
"<br>previous item: " + previousItem;
}

var tmp = document.getElementById("item");
if (tmp) { tmp.innerHTML = "item: " + currentItem; }

var tmp = document.getElementById("pid");
if (tmp) {
tmp.innerHTML = "(received from the player with the id: <i><b>" + obj.id + "</b></i>)";
}
nextItem = currentItem + 1;
printItemData(currentItem,"itmsDat", "",'<p>vote a venir</p>');
printItemData(nextItem,"itmsDat2","A suivre : ","");
}
}

function printItemData(theIndex,id,mot,vote) {
var plst = null;
plst = player.getPlaylist();

if (plst) {
var txt = '';
txt += '<p>' + mot;
//txt += '<li><b>item number: </b>' + theIndex + ':</li>';
txt += plst[theIndex].title;
txt += ' - ' + plst[theIndex].description + '</p>';
txt += vote;
var tmp = document.getElementById(id);
if (tmp) { tmp.innerHTML = txt; }
}
}

function initPlayer(theFile) {
        createPlayer(theFile);
}

function loadFile(theFile) {currentItem = 1; previousItem = 1; player.sendEvent('LOAD', theFile); setTimeout("player.sendEvent('PLAY', true)", 2500);};

function createPlayer(theFile) {
            var flashvars = {
                    file:theFile,
                    autostart:"false",
                    shuffle:"false",
controlbar:"top",
backcolor:"000000",
skin:"url/modieus.swf",
frontcolor:"FFFFFF",
lightcolor:"CCCCCC",
                    playlistsize:"172",
                    playlist:"bottom",
repeat:"list"

            }
            var params = {
                    allowscriptaccess:"always",
allowfullscreen:"false"
            }
            var attributes = {
                    id:"player1", 
                    name:"player1"
            }
            swfobject.embedSWF("url/player.swf", "player", "400", "192", "9.0.115", false, flashvars, params, attributes);
}

/* ]]> */

And HTML

<script type="text/javascript" src="scripts/swfobject.js"></script>
<script type="text/javascript" src="scripts/lecteur.js"></script>
<script type="text/javascript">initPlayer('playerxml.php');</script>

We can play the song 340 <a href="javascript:loadFile('playerxml.php?idmusique=340')" >here</a>

Can somebody help me ???

Regards
Nico

1.) loadfile /appears/ to be working correctly, so my guess is that there's something wrong with the output of playerxml.php.

2.) It sounds like the duration reported by the file meta-data may be incorrect. What types of files are you using? Are you manually setting the duration in the playlist? What version of the player are you using?