summaryrefslogtreecommitdiffstats
path: root/play
diff options
context:
space:
mode:
authorHolger Brunn <opensource@holgerbrunn.net>2013-01-24 16:13:17 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-01-28 13:26:11 -0500
commit959aebe07fffe334bf3dc3f2bfcf9c5e77fad92a (patch)
treee38e598eb859fdb906d8055c4d2724a62e854c0e /play
parent499aef74145a32db8c73aeacb9c5d2dd5da40771 (diff)
downloadampache-959aebe07fffe334bf3dc3f2bfcf9c5e77fad92a.tar.gz
ampache-959aebe07fffe334bf3dc3f2bfcf9c5e77fad92a.tar.bz2
ampache-959aebe07fffe334bf3dc3f2bfcf9c5e77fad92a.zip
Add an HTML5 player
Merge request #20. Basic, not very pretty, but works and, unlike the Flash player, is maintainable.
Diffstat (limited to 'play')
-rw-r--r--play/index.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/play/index.php b/play/index.php
index 498b7a2d..9c22f909 100644
--- a/play/index.php
+++ b/play/index.php
@@ -41,6 +41,7 @@ $sid = scrub_in($_REQUEST['ssid']);
$xml_rpc = scrub_in($_REQUEST['xml_rpc']);
$video = make_bool($_REQUEST['video']);
$type = scrub_in($_REQUEST['type']);
+$transcode_to = scrub_in($_REQUEST['transcode_to']);
if ($type == 'playlist') {
$playlist_type = scrub_in($_REQUEST['playlist_type']);
@@ -314,9 +315,15 @@ if (Config::get('downsample_remote')) {
// Determine whether to transcode
$transcode = false;
$transcode_cfg = Config::get('transcode');
+// transcode_to should only have an effect if the song is the wrong format
+$transcode_to = $transcode_to == $media->type ? null : $transcode_to;
$valid_types = $media->get_stream_types();
if ($transcode_cfg != 'never' && in_array('transcode', $valid_types)) {
- if ($transcode_cfg == 'always') {
+ if ($transcode_to) {
+ $transcode = true;
+ debug_event('play', 'Transcoding due to explicit request for ' . $transcode_to, 5);
+ }
+ else if ($transcode_cfg == 'always') {
$transcode = true;
debug_event('play', 'Transcoding due to always', 5);
}
@@ -335,7 +342,7 @@ if ($transcode_cfg != 'never' && in_array('transcode', $valid_types)) {
if ($transcode) {
header('Accept-Ranges: none');
- $transcoder = Stream::start_transcode($media);
+ $transcoder = Stream::start_transcode($media, $transcode_to);
$fp = $transcoder['handle'];
$media_name = $media->f_artist_full . " - " . $media->title . "." . $transcoder['format'];
}