mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update video events
This commit is contained in:
parent
a08715f2f2
commit
af998dcfd1
2 changed files with 110 additions and 75 deletions
|
@ -77,11 +77,14 @@
|
||||||
return currentStream.Type == "Subtitle";
|
return currentStream.Type == "Subtitle";
|
||||||
});
|
});
|
||||||
|
|
||||||
var currentIndex = self.currentSubtitleStreamIndex || -1;
|
var currentIndex = self.currentSubtitleStreamIndex;
|
||||||
|
if (currentIndex == null) {
|
||||||
|
currentIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
streams.unshift({
|
streams.unshift({
|
||||||
Index: -1,
|
Index: -1,
|
||||||
Language: "Off"
|
Language: Globalize.translate('ButtonOff')
|
||||||
});
|
});
|
||||||
|
|
||||||
var menuItems = streams.map(function (stream) {
|
var menuItems = streams.map(function (stream) {
|
||||||
|
@ -880,6 +883,15 @@
|
||||||
|
|
||||||
function bindEventsForPlayback(mediaRenderer) {
|
function bindEventsForPlayback(mediaRenderer) {
|
||||||
|
|
||||||
|
Events.on(mediaRenderer, 'playing', onOnePlaying);
|
||||||
|
Events.on(mediaRenderer, 'playing', onPlaying);
|
||||||
|
Events.on(mediaRenderer, 'volumechange', onVolumeChange);
|
||||||
|
Events.on(mediaRenderer, 'pause', onPause);
|
||||||
|
Events.on(mediaRenderer, 'timeupdate', onTimeUpdate);
|
||||||
|
Events.on(mediaRenderer, 'error', onError);
|
||||||
|
Events.on(mediaRenderer, 'click', onClick);
|
||||||
|
Events.on(mediaRenderer, 'dblclick', onDoubleClick);
|
||||||
|
|
||||||
var hideElementsOnIdle = true;
|
var hideElementsOnIdle = true;
|
||||||
|
|
||||||
if (hideElementsOnIdle) {
|
if (hideElementsOnIdle) {
|
||||||
|
@ -908,6 +920,16 @@
|
||||||
|
|
||||||
function unbindEventsForPlayback(mediaRenderer) {
|
function unbindEventsForPlayback(mediaRenderer) {
|
||||||
|
|
||||||
|
Events.off(mediaRenderer, 'playing', onOnePlaying);
|
||||||
|
Events.off(mediaRenderer, 'playing', onPlaying);
|
||||||
|
Events.off(mediaRenderer, 'volumechange', onVolumeChange);
|
||||||
|
|
||||||
|
Events.off(mediaRenderer, 'pause', onPause);
|
||||||
|
Events.off(mediaRenderer, 'timeupdate', onTimeUpdate);
|
||||||
|
Events.off(mediaRenderer, 'error', onError);
|
||||||
|
Events.off(mediaRenderer, 'click', onClick);
|
||||||
|
Events.off(mediaRenderer, 'dblclick', onDoubleClick);
|
||||||
|
|
||||||
$(document).off('webkitfullscreenchange', onFullScreenChange);
|
$(document).off('webkitfullscreenchange', onFullScreenChange);
|
||||||
$(document).off('mozfullscreenchange', onFullScreenChange);
|
$(document).off('mozfullscreenchange', onFullScreenChange);
|
||||||
$(document).off('msfullscreenchange', onFullScreenChange);
|
$(document).off('msfullscreenchange', onFullScreenChange);
|
||||||
|
@ -1091,77 +1113,6 @@
|
||||||
volumeSlider.value = initialVolume * 100;
|
volumeSlider.value = initialVolume * 100;
|
||||||
updateVolumeButtons(initialVolume);
|
updateVolumeButtons(initialVolume);
|
||||||
|
|
||||||
$(mediaRenderer).on("volumechange.mediaplayerevent", function (e) {
|
|
||||||
|
|
||||||
updateVolumeButtons(this.volume());
|
|
||||||
|
|
||||||
}).one("playing.mediaplayerevent", function () {
|
|
||||||
|
|
||||||
// For some reason this is firing at the start, so don't bind until playback has begun
|
|
||||||
$(this).on("ended", self.onPlaybackStopped).one('ended', self.playNextAfterEnded);
|
|
||||||
|
|
||||||
self.onPlaybackStart(this, item, mediaSource);
|
|
||||||
|
|
||||||
}).on("pause.mediaplayerevent", function (e) {
|
|
||||||
|
|
||||||
$('#video-playButton', videoControls).show();
|
|
||||||
$('#video-pauseButton', videoControls).hide();
|
|
||||||
$("#pause", videoElement).show().addClass("fadeOut");
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#pause", videoElement).hide().removeClass("fadeOut");
|
|
||||||
}, 300);
|
|
||||||
|
|
||||||
}).on("playing.mediaplayerevent", function (e) {
|
|
||||||
|
|
||||||
$('#video-playButton', videoControls).hide();
|
|
||||||
$('#video-pauseButton', videoControls).show();
|
|
||||||
$("#play", videoElement).show().addClass("fadeOut");
|
|
||||||
setTimeout(function () {
|
|
||||||
$("#play", videoElement).hide().removeClass("fadeOut");
|
|
||||||
}, 300);
|
|
||||||
|
|
||||||
}).on("timeupdate.mediaplayerevent", function () {
|
|
||||||
|
|
||||||
if (!positionSlider.dragging) {
|
|
||||||
|
|
||||||
self.setCurrentTime(self.getCurrentTicks(this), positionSlider, currentTimeElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
}).on("error.mediaplayerevent", function () {
|
|
||||||
|
|
||||||
var errorMsg = Globalize.translate('MessageErrorPlayingVideo');
|
|
||||||
|
|
||||||
if (item.Type == "TvChannel") {
|
|
||||||
errorMsg += '<p>';
|
|
||||||
errorMsg += Globalize.translate('MessageEnsureOpenTuner');
|
|
||||||
errorMsg += '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
Dashboard.alert({
|
|
||||||
title: Globalize.translate('HeaderVideoError'),
|
|
||||||
message: errorMsg
|
|
||||||
});
|
|
||||||
|
|
||||||
self.onPlaybackStopped.call(mediaRenderer);
|
|
||||||
self.nextTrack();
|
|
||||||
|
|
||||||
}).on("click.mediaplayerevent", function (e) {
|
|
||||||
|
|
||||||
if (!browserInfo.mobile) {
|
|
||||||
if (this.paused()) {
|
|
||||||
self.unpause();
|
|
||||||
} else {
|
|
||||||
self.pause();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}).on("dblclick.mediaplayerevent", function () {
|
|
||||||
|
|
||||||
if (!browserInfo.mobile) {
|
|
||||||
self.toggleFullscreen();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
bindEventsForPlayback(mediaRenderer);
|
bindEventsForPlayback(mediaRenderer);
|
||||||
|
|
||||||
self.currentSubtitleStreamIndex = mediaSource.DefaultSubtitleStreamIndex;
|
self.currentSubtitleStreamIndex = mediaSource.DefaultSubtitleStreamIndex;
|
||||||
|
@ -1186,6 +1137,90 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function onOnePlaying() {
|
||||||
|
|
||||||
|
Events.off(this, 'playing', onOnePlaying);
|
||||||
|
|
||||||
|
// For some reason this is firing at the start, so don't bind until playback has begun
|
||||||
|
Events.on(this, 'ended', self.onPlaybackStopped);
|
||||||
|
Events.on(this, 'ended', self.playNextAfterEnded);
|
||||||
|
|
||||||
|
self.onPlaybackStart(this, self.currentItem, self.currentMediaSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPlaying() {
|
||||||
|
|
||||||
|
var videoControls = document.querySelector('#videoPlayer .videoControls');
|
||||||
|
var videoElement = document.querySelector('#videoPlayer #videoElement');
|
||||||
|
|
||||||
|
$('#video-playButton', videoControls).hide();
|
||||||
|
$('#video-pauseButton', videoControls).show();
|
||||||
|
$("#play", videoElement).show().addClass("fadeOut");
|
||||||
|
setTimeout(function () {
|
||||||
|
$("#play", videoElement).hide().removeClass("fadeOut");
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onVolumeChange() {
|
||||||
|
|
||||||
|
updateVolumeButtons(this.volume());
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPause() {
|
||||||
|
|
||||||
|
var videoControls = document.querySelector('#videoPlayer .videoControls');
|
||||||
|
var videoElement = document.querySelector('#videoPlayer #videoElement');
|
||||||
|
|
||||||
|
$('#video-playButton', videoControls).show();
|
||||||
|
$('#video-pauseButton', videoControls).hide();
|
||||||
|
$("#pause", videoElement).show().addClass("fadeOut");
|
||||||
|
setTimeout(function () {
|
||||||
|
$("#pause", videoElement).hide().removeClass("fadeOut");
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTimeUpdate() {
|
||||||
|
if (!positionSlider.dragging) {
|
||||||
|
|
||||||
|
self.setCurrentTime(self.getCurrentTicks(this), positionSlider, currentTimeElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onError() {
|
||||||
|
var errorMsg = Globalize.translate('MessageErrorPlayingVideo');
|
||||||
|
|
||||||
|
if (item.Type == "TvChannel") {
|
||||||
|
errorMsg += '<p>';
|
||||||
|
errorMsg += Globalize.translate('MessageEnsureOpenTuner');
|
||||||
|
errorMsg += '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
Dashboard.alert({
|
||||||
|
title: Globalize.translate('HeaderVideoError'),
|
||||||
|
message: errorMsg
|
||||||
|
});
|
||||||
|
|
||||||
|
self.onPlaybackStopped.call(mediaRenderer);
|
||||||
|
self.nextTrack();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onClick() {
|
||||||
|
|
||||||
|
if (!browserInfo.mobile) {
|
||||||
|
if (this.paused()) {
|
||||||
|
self.unpause();
|
||||||
|
} else {
|
||||||
|
self.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDoubleClick() {
|
||||||
|
if (!browserInfo.mobile) {
|
||||||
|
self.toggleFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.updatePlaylistUi = function () {
|
self.updatePlaylistUi = function () {
|
||||||
|
|
||||||
if (!initComplete) {
|
if (!initComplete) {
|
||||||
|
|
|
@ -207,7 +207,7 @@
|
||||||
profile.TranscodingProfiles.push({
|
profile.TranscodingProfiles.push({
|
||||||
Container: 'mkv',
|
Container: 'mkv',
|
||||||
Type: 'Video',
|
Type: 'Video',
|
||||||
AudioCodec: 'aac' + (canPlayAc3 ? ',ac3' : ''),
|
AudioCodec: 'aac' + (canPlayAc3 ? ',ac3' : '') + (canPlayMp3 ? ',mp3' : ''),
|
||||||
VideoCodec: 'h264',
|
VideoCodec: 'h264',
|
||||||
Context: 'Streaming'
|
Context: 'Streaming'
|
||||||
});
|
});
|
||||||
|
@ -335,7 +335,7 @@
|
||||||
|
|
||||||
profile.CodecProfiles.push({
|
profile.CodecProfiles.push({
|
||||||
Type: 'VideoAudio',
|
Type: 'VideoAudio',
|
||||||
Codec: 'aac',
|
Codec: 'aac,mp3',
|
||||||
Conditions: [
|
Conditions: [
|
||||||
{
|
{
|
||||||
Condition: 'LessThanEqual',
|
Condition: 'LessThanEqual',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue