mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-04 18:29:40 +02:00
Fix HTML5 playlist autoscroll with large playlists
This commit is contained in:
parent
348c94ccd6
commit
cf117560e7
2 changed files with 14 additions and 14 deletions
|
@ -36,6 +36,7 @@ function PlayerFrame(URL)
|
||||||
maindiv.style.height = (parent.parent.innerHeight - 105) + "px";
|
maindiv.style.height = (parent.parent.innerHeight - 105) + "px";
|
||||||
}
|
}
|
||||||
ff.setAttribute('src', URL);
|
ff.setAttribute('src', URL);
|
||||||
|
window.location = '<?php echo return_referer() ?>';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -105,11 +105,11 @@ foreach ($playlist->urls as $item) {
|
||||||
$song = new Song($urlinfo['id']);
|
$song = new Song($urlinfo['id']);
|
||||||
$ftype = $song->type;
|
$ftype = $song->type;
|
||||||
|
|
||||||
// Check transcode is required
|
|
||||||
if ($type != $ftype) {
|
|
||||||
$transcode_cfg = Config::get('transcode');
|
$transcode_cfg = Config::get('transcode');
|
||||||
|
// Check transcode is required
|
||||||
|
if ($transcode_cfg == 'always' || $type != $ftype) {
|
||||||
$valid_types = Song::get_stream_types_for_type($ftype);
|
$valid_types = Song::get_stream_types_for_type($ftype);
|
||||||
if ($transcode_cfg != 'never' && in_array('transcode', $valid_types)) {
|
if ($transcode_cfg == 'always' || ($transcode_cfg != 'never' && in_array('transcode', $valid_types))) {
|
||||||
// Transcode only if excepted type available
|
// Transcode only if excepted type available
|
||||||
$transcode_settings = $song->get_transcode_settings($type);
|
$transcode_settings = $song->get_transcode_settings($type);
|
||||||
if ($transcode_settings) {
|
if ($transcode_settings) {
|
||||||
|
@ -123,22 +123,20 @@ foreach ($playlist->urls as $item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($transcode) {
|
if ($transcode) {
|
||||||
$url .= '&content_length=required&transcode_to=' . $type; // &content_length=required
|
$url .= '&transcode_to=' . $type;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$transcode) {
|
|
||||||
// Transcode not available for this song, keep real type and hope for flash fallback
|
|
||||||
$ext = pathinfo($url, PATHINFO_EXTENSION);
|
|
||||||
if ($ext) {
|
|
||||||
$type = $ext;
|
|
||||||
} else {
|
} else {
|
||||||
// Cannot found stream type, use the default one
|
|
||||||
$type = $ftype;
|
$type = $ftype;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$ext = pathinfo($url, PATHINFO_EXTENSION);
|
||||||
|
$type = $ext ?: $ftype;
|
||||||
}
|
}
|
||||||
|
$url .= "&content_length=required";
|
||||||
|
|
||||||
$jtype = ($type == "ogg" || $type == "flac") ? "oga" : $type;
|
$jtype = ($type == "ogg" || $type == "flac") ? "oga" : $type;
|
||||||
|
|
||||||
|
@ -183,9 +181,10 @@ if ($iframed) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#jquery_jplayer_1").bind($.jPlayer.event.play, function (event) {
|
$("#jquery_jplayer_1").bind($.jPlayer.event.play, function (event) {
|
||||||
$(".jp-playlist").scrollTop($(".jp-playlist-current").position().top);
|
|
||||||
var current = myPlaylist.current,
|
var current = myPlaylist.current,
|
||||||
playlist = myPlaylist.playlist;
|
playlist = myPlaylist.playlist;
|
||||||
|
var pos = $(".jp-playlist-current").position().top + $(".jp-playlist").scrollTop();
|
||||||
|
$(".jp-playlist").scrollTop(pos);
|
||||||
$.each(playlist, function (index, obj) {
|
$.each(playlist, function (index, obj) {
|
||||||
if (index == current) {
|
if (index == current) {
|
||||||
$('.playing_title').text(obj.title);
|
$('.playing_title').text(obj.title);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue