resolve live tv with ios

This commit is contained in:
Luke Pulverenti 2015-04-28 09:56:57 -04:00
parent 1ad8c6e955
commit 77fb2070f5
3 changed files with 33 additions and 40 deletions

View File

@ -69,9 +69,6 @@
ApiClient.reportPlaybackStopped(stopInfo);
}).on('positionchange.mediacontroller', function (e, state) {
});
}

View File

@ -931,6 +931,31 @@
var streamInfo = self.createStreamInfo('Video', item, mediaSource, startPosition);
// Huge hack alert. Safari doesn't seem to like if the segments aren't available right away when playback starts
// This will start the transcoding process before actually feeding the video url into the player
if ($.browser.safari && !mediaSource.RunTimeTicks) {
Dashboard.showLoadingMsg();
ApiClient.ajax({
type: 'GET',
url: streamInfo.url.replace('master.m3u8', 'live.m3u8')
}).always(function () {
Dashboard.hideLoadingMsg();
}).done(function () {
self.playVideoInternal(item, mediaSource, startPosition, streamInfo);
});
} else {
self.playVideoInternal(item, mediaSource, startPosition, streamInfo);
}
};
self.playVideoInternal = function (item, mediaSource, startPosition, streamInfo) {
var videoUrl = streamInfo.url;
var contentType = streamInfo.contentType;
var startPositionInSeekParam = streamInfo.startPositionInSeekParam;
@ -975,8 +1000,9 @@
// Can't autoplay in these browsers so we need to use the full controls
if (requiresNativeControls) {
html += '<video class="itemVideo" id="itemVideo" preload="none" autoplay="autoplay" crossorigin="anonymous" controls="controls"' + posterCode + '>';
} else {
html += '<video class="itemVideo" id="itemVideo" preload="metadata" autoplay="autoplay" crossorigin="anonymous" controls="controls"' + posterCode + '>';
}
else {
// Chrome 35 won't play with preload none
html += '<video class="itemVideo" id="itemVideo" preload="metadata" crossorigin="anonymous" autoplay' + posterCode + '>';
@ -1167,7 +1193,10 @@
$('body').addClass('bodyWithPopupOpen');
return video[0];
self.currentMediaElement = video[0];
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
self.updateNowPlayingInfo(item);
};
self.updatePlaylistUi = function () {

View File

@ -379,36 +379,6 @@
return false;
};
self.getVideoTranscodingExtension = function (currentSrc) {
if (currentSrc) {
return self.getCurrentMediaExtension(currentSrc);
}
// safari
if (self.canPlayHls()) {
return '.m3u8';
}
// Chrome, Firefox or IE with plugin installed
// For some reason in chrome pausing mp4 is causing the video to fail.
// So for now it will have to prioritize webm
if (self.canPlayWebm()) {
if ($.browser.msie) {
return '.webm';
}
if ($.browser.chrome) {
return '.webm';
}
// Firefox suddenly having trouble with our webm
return '.webm';
}
return '.mp4';
};
self.changeStream = function (ticks, params) {
var element = self.currentMediaElement;
@ -895,10 +865,7 @@
if (item.MediaType === "Video") {
self.currentMediaElement = self.playVideo(item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
self.updateNowPlayingInfo(item);
self.playVideo(item, self.currentMediaSource, startPosition);
} else if (item.MediaType === "Audio") {