From 596c7b5f68f51489aac115cb7a6d5a622195bd45 Mon Sep 17 00:00:00 2001 From: Alib Date: Tue, 16 Mar 2010 16:15:45 +0100 Subject: mp3 now functionnal --- js/istreamdev.js | 53 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'js/istreamdev.js') diff --git a/js/istreamdev.js b/js/istreamdev.js index 6e21e35..091b145 100644 --- a/js/istreamdev.js +++ b/js/istreamdev.js @@ -397,7 +397,7 @@ function playvideo(session,name) { // [BROWSER SECTION] //buttons -$('ul[rel="filelist"] li a').tap(function(event) { +$('ul[rel="filelist"] li[class="arrow"] a').tap(function(event) { event.preventDefault(); json_start(this); var type = $(this).attr('rel'); @@ -432,11 +432,14 @@ $('ul[rel="filelist"] li a').tap(function(event) { else if ( type == "audio" ) { var track = $(this).find('span[class="number"]').html(); - addplayer(path,name,track); - } + addplayer(path,name,track,(browser-1)); + } return false; }); + + + $('div[rel="browser"] a[class="back"]').tap(function(event) { event.preventDefault(); $(this).parents('div[rel="browser"]').remove(); @@ -451,6 +454,8 @@ $('div[rel="browser"] #home_but').tap(function(event) { }); }); + + //Generate browser div according to type function gen_browser(path,browser,name,foldertype) { browser_template = '
'; @@ -507,7 +512,7 @@ function gen_browser(path,browser,name,foldertype) { $("#browser" + browser).find('ul').append('
  • ' + list.name + '
  • '); } else if ( list.type == "audio" ) { - $("#browser" + browser).find('ul').append('
  • ' + list.number + '
    ' + list.name + '
    ' + list.length +'
  • '); + $("#browser" + browser).find('ul').append('
  • ' + list.number + '
    ' + list.name + '
    ' + list.length +'
  • '); } }); json_complete('#browser' + browser,'cube'); @@ -515,26 +520,36 @@ function gen_browser(path,browser,name,foldertype) { } //Add audio player code when needed -function addplayer(path,name,track) { - $('#div_player').remove(); - $('#jqt').append('
    '); +function addplayer(button) { + json_start(button); + var name = $(button).find('span[class="tracktitle"]').html(); + var path = $(button).parents('div').find('span[rel="path"]').html(); + var browser = $(button).parents('div').find('span[rel="currentbrowser"]').html(); + browser = parseInt(browser); + $('#browser'+browser+' #div_player').remove(); + $('#browser'+browser).append('
    '); //get playlist data dataString = 'action=streamAudio&path=' + path + '&file=' + name; - $.getJSON("bin/backend.php", - dataString, - function(data) { - track = data.track; - playercode= "1; i-=1 ){ - playercode += "qtnext" + i + "='<" + escape(track[i].file) + ">' "; + $.ajax({ + url: "bin/backend.php", + dataType: 'json', + data: dataString, + async: false, + success: function(json) { + var track = json.track; + playercode = "'"; + playercode += "qtnext" + i + "=" + qtattr; + } + playercode += ">"; + $('#div_player').html(playercode); + hide_loader(); + return true; } - playercode+= ">"; - $('#div_player').html(playercode); - hide_loader(); - $('#div_player player').play(); + }); } - // [/BROWSER SECTION] // [TIMER SECTION] -- cgit v1.2.3