fix persistent playlist for media player

remotes/origin/stable
Robin Appelman 14 years ago
parent c39c6d36df
commit 1639a1ca49
  1. 19
      apps/media/css/player.css
  2. 9
      apps/media/js/loader.js
  3. 10
      apps/media/js/player.js
  4. 1
      apps/media/js/playlist.js
  5. 2
      apps/media/templates/music.php
  6. 16
      apps/media/templates/player.php
  7. 8
      files/js/fileactions.js

@ -0,0 +1,19 @@
#playercontrols{
display:inline;
width:7em;
height:1em;
position:fixed;
top:auto;
left:auto;
background:transparent;
box-shadow:none;
-webkit-box-shadow:none;
}
#playercontrols li{
float:left;
}
#playercontrols a, #playercontrols li{
margin:0px;
padding:0;
left:0;
}

@ -22,16 +22,17 @@ function addAudio(filename){
function loadPlayer(type,ready){
if(!loadPlayer.done){
loadPlayer.done=true;
OC.addStyle('media','player');
OC.addScript('media','jquery.jplayer.min',function(){
OC.addScript('media','player',function(){
$('body').append($('<div id="playerPlaceholder"/>'))
$('#playerPlaceholder').append($('<div/>')).load(OC.filePath('media','templates','player.php'),function(){
loadPlayer.done=true;
var navItem=$('#apps a[href="'+OC.linkTo('media','index.php')+'"]');
navItem.height(navItem.height());
navItem.load(OC.filePath('media','templates','player.php'),function(){
PlayList.init(type,ready);
});
});
});
OC.addStyle('media','player');
}else{
ready();
}

@ -28,6 +28,7 @@ var PlayList={
if(index==null){
index=PlayList.current;
}
PlayList.save();
if(index>-1 && index<items.length){
PlayList.current=index;
if(PlayList.player){
@ -35,7 +36,7 @@ var PlayList={
PlayList.player.jPlayer("play",time);
localStorage.setItem(oc_current_user+'oc_playlist_time',time);
PlayList.player.jPlayer("destroy");
PlayList.save(); // so that the init don't lose the playlist
// PlayList.save(); // so that the init don't lose the playlist
PlayList.init(items[index].type,null); // init calls load that calls play
}else{
PlayList.player.jPlayer("setMedia", items[PlayList.current]);
@ -57,6 +58,7 @@ var PlayList={
if (typeof Collection !== 'undefined') {
Collection.registerPlay();
}
PlayList.render();
if(ready){
ready();
}
@ -64,7 +66,7 @@ var PlayList={
}else{
localStorage.setItem(oc_current_user+'oc_playlist_time',time);
localStorage.setItem(oc_current_user+'oc_playlist_playing','true');
PlayList.save(); // so that the init don't lose the playlist
// PlayList.save(); // so that the init don't lose the playlist
PlayList.init(items[index].type,null); // init calls load that calls play
}
}
@ -85,7 +87,7 @@ var PlayList={
PlayList.render();
return false;
});
PlayList.player=$('#controls div.player');
PlayList.player=$('#jp-player');
}
$(PlayList.player).jPlayer({
ended:PlayList.next,
@ -103,7 +105,7 @@ var PlayList={
}
},
volume:PlayList.volume,
cssSelectorAncestor:'#controls',
cssSelectorAncestor:'.player-controls',
swfPath:OC.linkTo('media','js'),
});
},

@ -30,6 +30,7 @@ PlayList.hide=function(){
$(document).ready(function(){
PlayList.parent=$('#leftcontent');
PlayList.init();
$('#selectAll').click(function(){
if($(this).attr('checked')){
// Check all

@ -1,4 +1,4 @@
<div id="controls">
<div class='player-controls' id="controls">
<ul class="jp-controls">
<li><a href="#" class="jp-play action"><img class="svg" alt="<?php echo $l->t('Play');?>" src="<?php echo image_path('core', 'actions/play-big.svg'); ?>" /></a></li>
<li><a href="#" class="jp-pause action"><img class="svg" alt="<?php echo $l->t('Pause');?>" src="<?php echo image_path('core', 'actions/pause-big.svg'); ?>" /></a></li>

@ -0,0 +1,16 @@
<?php
if(!isset($_)){//allow the template to be loaded standalone
require_once '../../../lib/base.php';
$tmpl = new OC_Template( 'media', 'player');
$tmpl->printPage();
exit;
}
?>
<div class='player-controls' id="playercontrols">
<div class="player" id="jp-player"></div>
<ul class="jp-controls">
<li><a href="#" class="jp-play action"><img class="svg" alt="<?php echo $l->t('Play');?>" src="<?php echo image_path('core', 'actions/play.svg'); ?>" /></a></li>
<li><a href="#" class="jp-pause action"><img class="svg" alt="<?php echo $l->t('Pause');?>" src="<?php echo image_path('core', 'actions/pause.svg'); ?>" /></a></li>
<li><a href="#" class="jp-next action"><img class="svg" alt="<?php echo $l->t('Next');?>" src="<?php echo image_path('core', 'actions/play-next.svg'); ?>" /></a></li>
</ul>
</div>

@ -53,7 +53,7 @@ FileActions={
},
display:function(parent){
FileActions.currentFile=parent;
$('.action').remove();
$('#fileList .action').remove();
var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
var file=FileActions.getCurrentFile();
if($('tr[data-file="'+file+'"]').data('renaming')){
@ -104,12 +104,12 @@ FileActions={
});
parent.parent().children().last().append(element);
}
$('.action').hide();
$('.action').fadeIn(200);
$('#fileList .action').hide();
$('#fileList .action').fadeIn(200);
return false;
},
hide:function(){
$('.action').fadeOut(200,function(){
$('#fileList .action').fadeOut(200,function(){
$(this).remove();
});
},

Loading…
Cancel
Save