diff -r 44d58d2e90b5 -r 3a3c15c462f8 client/player/js/LdtPlayer.js --- a/client/player/js/LdtPlayer.js Tue Jun 15 01:33:03 2010 +0200 +++ b/client/player/js/LdtPlayer.js Mon Jul 12 12:01:22 2010 +0200 @@ -3,10 +3,10 @@ ---------------------------------------------------------------- LDTPlayer is created by http://www.iri.centrepompidou.fr - 2010-06-10 + 2010-06-14 - version 0.07 - Initiated By Samuel Huron < samuel.huron (at) cybunk (dot) com - this version is the 0.06 + init By Samuel Huron < samuel.huron (at) cybunk (dot) com > + ---------------------------------------------------------------- */ @@ -146,14 +146,14 @@ if (tmp) { tmp.innerHTML = "volume: " + currentVolume; } } - function createPlayer(width,height,url) { + function createPlayer(width,height,url,duration,streamerPath,MySwfPath) { - myUrlFragment = url.split("/"); - // - file = myUrlFragment[myUrlFragment.length-3]+"/"+myUrlFragment[myUrlFragment.length-2]+"/"+myUrlFragment[myUrlFragment.length-1]; - indexofff = url.lastIndexOf(file); - streamer = url.substr(0,indexofff); - alert(url+"="+streamer+" - "+file); + myUrlFragment = url.split(streamerPath); + file = myUrlFragment[1]; + //alert(url+" = "+streamerPath+" + "+file); + streamer = streamerPath; + //alert(" StreamerPath : "+streamer+" - "+file); + //alert(" SwfPath : "+MySwfPath); var flashvars = { streamer:streamer, @@ -174,7 +174,7 @@ name:"Ldtplayer1" } - swfobject.embedSWF("swf/player.swf", "ldtPlaceHolder", width, height, "9.0.115", false, flashvars, params, attributes); + swfobject.embedSWF(MySwfPath, "ldtPlaceHolder", width, height, "9.0.115", false, flashvars, params, attributes); } @@ -194,19 +194,62 @@ var playerLdtWidth; var playerLdtHeight; - function loadJson (width,height,urlJson){ + function loadJson (width,height,urlJson,MySwfPath){ playerLdtWidth=width; playerLdtHeight=height; $jIRI.ajax({ dataType: 'jsonp', - url:urlJson, + url:urlJson,//+"?callback=callbackLdts", + //jsonpCallback:callbackLdts, success: function(json){ - //alert("success !"); - + //eval(json); + //alert("callback LDTS"); + /* START PARSING ----------------------- */ + /* metas , medias , annotation-types , annotations , lists , tags , views */ + /* # fonction avec 1 seul media et 1 seul annotation type code a cleaner */ + /* # créer le player */ + //$jIRI.each(json.medias, function(i,item) { + //}); + $jIRI("
").appendTo("#output"); + MyMedia = new Media(json.medias[0].id,json.medias[0].href,json.medias[0]["meta"]["dc:duration"],json.medias[0]['dc:title'],json.medias[0]['dc:description']); + //alert(" MySwfPath : "+MySwfPath); + MyMedia.createPlayer(playerLdtWidth,playerLdtHeight,json.medias[0]["meta"]["item"]["value"],MySwfPath); + //alert("success loading ! "+json.medias[0]["meta"]["dc:duration"]+ " | " +json.medias[0]["meta"]["item"]["value"]); + + /* # créer lignes */ + /*$jIRI.each(json['annotation-types'], function(i,item) { + });*/ + MyLdt = new Ligne (json['annotation-types'][0].id,json['annotation-types'][0]['dc:title'],json['annotation-types'][0]['dc:description'],json.medias[0]["meta"]["dc:duration"]); + //alert("duration : "+json.medias[0]["dc:duration"]); + /* # créer les annotations */ + $jIRI.each(json.annotations, function(i,item) { + + MyLdt.addAnnotation( + item.id, + item.begin, + item.end, + item.media, + item.content.title, + item.content.description, + item.content.color); + + }); + $jIRI.each(json.lists, function(i,item) { + trace("lists",""); + }); + $jIRI.each(json.tags, function(i,item) { + trace("tags",""); + }); + $jIRI.each(json.views, function(i,item) { + trace("views",""); + }); + /* END PARSING ----------------------- */ + + } ,error: function(data){ alert("ERROR : "+data); @@ -215,45 +258,6 @@ } function callbackLdts(json){ - /* START PARSING ----------------------- */ - /* metas , medias , annotation-types , annotations , lists , tags , views */ - /* # fonction avec 1 seul media et 1 seul annotation type code a cleaner */ - /* # créer le player */ - //$jIRI.each(json.medias, function(i,item) { - //}); - $jIRI("").appendTo("#output"); - MyMedia = new Media(json.medias[0].id,json.medias[0].url,json.medias[0]["dc:duration"],json.medias[0]['dc:title'],json.medias[0]['dc:description']); - MyMedia.createPlayer(playerLdtWidth,playerLdtHeight); - - /* # créer lignes */ - /*$jIRI.each(json['annotation-types'], function(i,item) { - });*/ - MyLdt = new Ligne (json['annotation-types'][0].id,json['annotation-types'][0]['dc:title'],json['annotation-types'][0]['dc:description'],json.medias[0]["dc:duration"]); - //alert("duration : "+json.medias[0]["dc:duration"]); - - /* # créer les annotations */ - $jIRI.each(json.annotations, function(i,item) { - - MyLdt.addAnnotation( - item.id, - item.begin, - item.end, - item.media, - item.content.title, - item.content.description, - item.content.color); - - }); - $jIRI.each(json.lists, function(i,item) { - trace("lists",""); - }); - $jIRI.each(json.tags, function(i,item) { - trace("tags",""); - }); - $jIRI.each(json.views, function(i,item) { - trace("views",""); - }); - /* END PARSING ----------------------- */ } @@ -269,13 +273,10 @@ INIT player LDT */ - function playerLdt (width,height,file,divId){ - - //$jIRI("#playerLdt").append("