diff options
author | TheTroll <trolldev@gmail.com> | 2010-03-16 17:11:29 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-03-16 17:11:29 +0100 |
commit | 0f4709a212719a1eb83b9ca205eb545d53b3b4ac (patch) | |
tree | 065064b5271c0d6e6fabfaac0521843f67023cd2 | |
parent | 5bf4c116309cede976a6e987de2746a755171d31 (diff) | |
parent | ddb4b1dd2d3e5f1ac7de440de34be33e91e5f205 (diff) | |
download | istreamdev-0f4709a212719a1eb83b9ca205eb545d53b3b4ac.tar.gz istreamdev-0f4709a212719a1eb83b9ca205eb545d53b3b4ac.tar.bz2 |
Merge branch 'jquery' of projects.vdr-developer.org:istreamdev into jquery
* 'jquery' of projects.vdr-developer.org:istreamdev:
mp3 now functionnal
-rw-r--r-- | bin/textfiles/streamAudio.txt | 6 | ||||
-rw-r--r-- | css/istreamdev.css | 6 | ||||
-rw-r--r-- | js/istreamdev.js | 53 |
3 files changed, 40 insertions, 25 deletions
diff --git a/bin/textfiles/streamAudio.txt b/bin/textfiles/streamAudio.txt index a90d122..ebf7d17 100644 --- a/bin/textfiles/streamAudio.txt +++ b/bin/textfiles/streamAudio.txt @@ -2,13 +2,13 @@ track: [ { - "file": "/istreamdev/playlist/track1.mp3" + "file": "http://alib.hd.free.fr/istreamdev2/playlist/track1.mp3" }, { - "file": "/istreamdev/playlist/track2.mp3" + "file": "http://alib.hd.free.fr/istreamdev2/playlist/track2.mp3" }, { - "file": "/istreamdev/playlist/track3.mp3" + "file": "http://alib.hd.free.fr/istreamdev2/playlist/track3.mp3" } ] } diff --git a/css/istreamdev.css b/css/istreamdev.css index aa07a18..e1da055 100644 --- a/css/istreamdev.css +++ b/css/istreamdev.css @@ -276,7 +276,7 @@ li.track a .numberbox { position: relative; width: 23px; height: 42px; -top: -10px; +top: -12px; display: block; float: left; margin-right: 3px; @@ -299,7 +299,7 @@ li.track a div.timebox { position: relative; width: 30px; height: 42px; -top: -38px; +top: -12px; display: block; float: right; margin-left: 3px; @@ -309,7 +309,7 @@ border-left: 1px solid #333333; li.track a .time { position: absolute; color: #9c9ea0; -top: 13px; +top: 12px; left: 5px; font-size: 14px; } 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 = '<div class="toolbar"></div>';
@@ -507,7 +512,7 @@ function gen_browser(path,browser,name,foldertype) { $("#browser" + browser).find('ul').append('<li class="arrow"><a href="#" rel="video"><img class="menuicon" src="img/video.png" /><span class="menuname">' + list.name + '</span></a></li>');
}
else if ( list.type == "audio" ) {
- $("#browser" + browser).find('ul').append('<li class="track"><a href="" rel="audio"><div class="numberbox"><span class="number">' + list.number + '</span></div><span class="tracktitle">' + list.name + '</span><div class="timebox"><span class="time">' + list.length +'</span></div></a></li>');
+ $("#browser" + browser).find('ul').append('<li class="track"><a href="javascript:document.player.Play();" onclick="addplayer(this);" rel="audio"><div class="numberbox"><span class="number">' + list.number + '</span></div><span class="tracktitle">' + list.name + '</span><div class="timebox"><span class="time">' + list.length +'</span></div></a></li>');
}
});
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('<div style="position:absolute; left:0; top:0" name="div_player" id="div_player">');
+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('<div style="position:absolute; left:0; top:0" name="div_player" id="div_player"></div>');
//get playlist data
dataString = 'action=streamAudio&path=' + path + '&file=' + name;
- $.getJSON("bin/backend.php",
- dataString,
- function(data) {
- track = data.track;
- playercode= "<embed target='myself' src='" + escape(track[track.length-1].file) + "' width='0' height='0' autoplay='true' name='player' type='audio/mp3' loop='true' controller='false' ";
- for ( var i=track.length-1; i>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 = "<embed id='musicplayer' enablejavascript='true' id='musicplayer' src='" + track[0].file + "' width='0' height='0' autoplay='false' name='player' type='audio/mp3' loop='true' controller='false'";
+ for ( var i=1; i<track.length; i+=1 ) {
+ qtattr = "'<" + track[i].file + ">'";
+ playercode += "qtnext" + i + "=" + qtattr;
+ }
+ playercode += "></embed>";
+ $('#div_player').html(playercode);
+ hide_loader();
+ return true;
}
- playercode+= "></embed>";
- $('#div_player').html(playercode);
- hide_loader();
- $('#div_player player').play();
+
});
}
-
// [/BROWSER SECTION]
// [TIMER SECTION]
|