1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Video player fixes

Mobile playback fixed - video no longer hidden by default and unhidden
on playing
Footer notifications fixed
This commit is contained in:
Tim Hobbs 2014-03-17 15:37:05 -07:00
parent 941824a5fb
commit 96e64c4f1f
5 changed files with 79 additions and 39 deletions

View file

@ -254,8 +254,20 @@ input[type="range"]::-ms-fill-upper {
display: none; /* display and visibility only */ display: none; /* display and visibility only */
} }
@media all and (max-width: 1200px) {
.volumeSliderContainer, .sendMediaButton {
display: none!important;
}
}
@media all and (max-width: 960px) {
.volumeSliderContainer, .audioTracksButton, .chaptersButton, .sendMediaButton {
display: none!important;
}
}
@media all and (max-width: 800px) { @media all and (max-width: 800px) {
.volumeButton, .volumeSliderContainer, .muteButton, .unmuteButton, .nowPlayingMediaInfo { .volumeButton, .volumeSliderContainer, .muteButton, .unmuteButton, .nowPlayingMediaInfo, .sendMediaButton {
display: none!important; display: none!important;
} }
} }
@ -264,10 +276,8 @@ input[type="range"]::-ms-fill-upper {
.positionSliderContainer { .positionSliderContainer {
width: 80px; width: 80px;
} }
}
@media all and (max-width: 600px) { .chaptersButton, .audioTracksButton, .qualityButton, .subtitleButton {
.chaptersButton, .audioTracksButton, .sendMediaButton {
display: none!important; display: none!important;
} }

View file

@ -692,7 +692,7 @@ h1 .imageLink {
.footerNotification { .footerNotification {
text-shadow: none; text-shadow: none;
padding: .75em 1em; padding: 0 1em .75em;
margin: 0; margin: 0;
font-weight: normal; font-weight: normal;
border-top: 1px solid #555; border-top: 1px solid #555;

View file

@ -41,13 +41,26 @@
}; };
self.resetEnhancements = function () { self.resetEnhancements = function () {
var footer = $("#footer"); var footer = $("#footer");
var videoBackdrop = $("#videoBackdrop", footer);
var mediaElement = $("#mediaElement", videoBackdrop); var mediaPlayer = $("#mediaPlayer", footer);
var nowPlayingBar = $("#nowPlayingBar", videoBackdrop);
var mediaElement = $("#mediaElement", mediaPlayer);
var nowPlayingBar = $("#nowPlayingBar", mediaPlayer);
mediaElement.html(""); // remove play/pause mediaElement.html(""); // remove play/pause
footer.hide().append(mediaElement).append(nowPlayingBar);
videoBackdrop.remove(); mediaPlayer.hide().append(nowPlayingBar); // put elements back where they belong
$("#videoBackdrop", footer).hide();
if ($("#footerNotifications", footer).html() == "") { // only hide footer if no notifications
footer.hide();
}
}; };
self.exitFullScreen = function () { self.exitFullScreen = function () {
@ -216,16 +229,14 @@
var play = $("<div id='play' class='status'></div>"); var play = $("<div id='play' class='status'></div>");
var pause = $("<div id='pause' class='status'></div>"); var pause = $("<div id='pause' class='status'></div>");
mediaElement.append(play).append(pause); mediaElement.append(play).append(pause);
var videoBackdrop = $("<div id='videoBackdrop'></div>"); $("#videoBackdrop", footer).show();
var videoPlayer = $("<div id='videoPlayer'></div>")
.append(mediaElement)
.append(nowPlayingBar);
videoPlayer.hide(); var videoPlayer = $("#videoPlayer", footer)
videoBackdrop.append(videoPlayer); //.hide()
footer.append(videoBackdrop); .append(nowPlayingBar);
// Stop playback on browser back button nav // Stop playback on browser back button nav
$(window).on("popstate", function () { $(window).on("popstate", function () {
@ -270,13 +281,13 @@
$("html").css("cursor", "progress"); $("html").css("cursor", "progress");
}) })
.on("playing", function (e) { .on("canplay", function () {
$(".ui-loader").hide(); $(".ui-loader").hide();
$("html").css("cursor", "default"); $("html").css("cursor", "default");
videoPlayer.fadeIn(); //videoPlayer.fadeIn();
checkAspectRatio(); checkAspectRatio();
@ -319,8 +330,6 @@
} }
}); });
video.play();
fullscreenExited = false; fullscreenExited = false;
}; };
@ -885,9 +894,9 @@
// Can't autoplay in these browsers so we need to use the full controls // Can't autoplay in these browsers so we need to use the full controls
if (requiresControls) { if (requiresControls) {
html += '<video class="itemVideo" autoplay controls preload="none">'; html += '<video class="itemVideo" id="itemVideo" autoplay controls preload="none">';
} else { } else {
html += '<video class="itemVideo" autoplay preload="none">'; html += '<video class="itemVideo" id="itemVideo" autoplay preload="none">';
} }
if (!isStatic) { if (!isStatic) {

View file

@ -231,8 +231,6 @@
self.volumeSlider = $('.volumeSlider').on('slidestop', function () { self.volumeSlider = $('.volumeSlider').on('slidestop', function () {
console.log("slidestop");
var vol = this.value; var vol = this.value;
self.updateVolumeButtons(vol); self.updateVolumeButtons(vol);
@ -658,6 +656,8 @@
var mediaElement; var mediaElement;
$("#mediaPlayer").show();
if (item.MediaType === "Video") { if (item.MediaType === "Video") {
videoPlayer(self, item, startPosition, user); videoPlayer(self, item, startPosition, user);
@ -741,10 +741,6 @@
nowPlayingText = (seriesName ? seriesName : "") + "\n" + (name || "---"); nowPlayingText = (seriesName ? seriesName : "") + "\n" + (name || "---");
} }
console.log("name", name);
console.log("seriesName", seriesName);
console.log("nowPlayingText", nowPlayingText);
// Fix for apostrophes and quotes // Fix for apostrophes and quotes
var htmlTitle = trimTitle(nowPlayingText).replace(/'/g, '&apos;').replace(/"/g, '&quot;'); var htmlTitle = trimTitle(nowPlayingText).replace(/'/g, '&apos;').replace(/"/g, '&quot;');
html += "<div><a href='" + href + "'><img class='nowPlayingBarImage' alt='" + htmlTitle + html += "<div><a href='" + href + "'><img class='nowPlayingBarImage' alt='" + htmlTitle +
@ -1125,22 +1121,24 @@
elem.pause(); elem.pause();
$(elem).off('ended.playnext').on('ended', function () { $(elem).off("ended.playnext").on("ended", function () {
$(this).remove(); $(this).remove();
elem.src = ""; elem.src = "";
currentMediaElement = null; currentMediaElement = null;
}).trigger('ended'); }).trigger("ended");
var footer = $('#footer'); $("#mediaPlayer").hide();
footer.hide();
if (currentItem.MediaType == "Video") { if (currentItem.MediaType == "Video") {
if (self.isFullScreen()) { if (self.isFullScreen()) {
self.exitFullScreen(); self.exitFullScreen();
} }
self.resetEnhancements(); self.resetEnhancements();
} else {
var footer = $("#footer");
footer.hide();
} }
}; };

View file

@ -292,7 +292,9 @@ var Dashboard = {
options.id = options.id || "notification" + new Date().getTime() + parseInt(Math.random()); options.id = options.id || "notification" + new Date().getTime() + parseInt(Math.random());
var parentElem = $('#footerNotifications'); var footer = $("#footer").show();
var parentElem = $('#footerNotifications', footer);
var elem = $('#' + options.id, parentElem); var elem = $('#' + options.id, parentElem);
@ -300,7 +302,7 @@ var Dashboard = {
elem = $('<p id="' + options.id + '" class="footerNotification"></p>').appendTo(parentElem); elem = $('<p id="' + options.id + '" class="footerNotification"></p>').appendTo(parentElem);
} }
var onclick = removeOnHide ? "$(\"#" + options.id + "\").remove();" : "$(\"#" + options.id + "\").hide();"; var onclick = removeOnHide ? "$(\"#" + options.id + "\").trigger(\"notification.remove\").remove();" : "$(\"#" + options.id + "\").trigger(\"notification.hide\").hide();";
if (options.allowHide !== false) { if (options.allowHide !== false) {
options.html += "<span style='margin-left: 1em;'><button type='button' onclick='" + onclick + "' data-icon='delete' data-iconpos='notext' data-mini='true' data-inline='true' data-theme='b'>Hide</button></span>"; options.html += "<span style='margin-left: 1em;'><button type='button' onclick='" + onclick + "' data-icon='delete' data-iconpos='notext' data-mini='true' data-inline='true' data-theme='b'>Hide</button></span>";
@ -310,20 +312,29 @@ var Dashboard = {
elem.show(); elem.show();
} }
elem.html(options.html).trigger('create'); elem.html(options.html).trigger("create");
if (options.timeout) { if (options.timeout) {
setTimeout(function () { setTimeout(function () {
if (removeOnHide) { if (removeOnHide) {
elem.remove(); elem.trigger("notification.remove").remove();
} else { } else {
elem.hide(); elem.trigger("notification.hide").hide();
} }
}, options.timeout); }, options.timeout);
} }
footer.on("notification.remove notification.hide", function (e) {
setTimeout(function () { // give the DOM time to catch up
console.log("html", parentElem.html() == "", this);
if (parentElem.html() == "") {
footer.slideUp();
}
}, 50);
});
}, },
getConfigurationPageUrl: function (name) { getConfigurationPageUrl: function (name) {
@ -1306,10 +1317,20 @@ $(ApiClient).on("websocketmessage", Dashboard.onWebSocketMessageReceived);
$(function () { $(function () {
var footerHtml = '<div id="footer" data-theme="b" class="ui-bar-b" style="display: none;">'; var footerHtml = '<div id="footer" data-theme="b" class="ui-bar-b" style="display: none;">';
footerHtml += '<div id="mediaPlayer" style="display: none;">';
footerHtml += '<div id="videoBackdrop" style="display: none;">';
footerHtml += '<div id="videoPlayer">';
footerHtml += '<div id="mediaElement"></div>'; footerHtml += '<div id="mediaElement"></div>';
footerHtml += '</div>';
footerHtml += '</div>';
footerHtml += '<div id="nowPlayingBar" class="nowPlayingBar">'; footerHtml += '<div id="nowPlayingBar" class="nowPlayingBar">';
footerHtml += '<div class="barBackground ui-bar-b">'; footerHtml += '<div class="barBackground ui-bar-b">';
footerHtml += '<div style="display:inline-block;width:12px;"></div>'; footerHtml += '<div style="display:inline-block;width:12px;"></div>';
footerHtml += '<a id="playlistButton" class="mediaButton playlistButton" href="playlist.html" data-role="button" data-icon="bullets" data-iconpos="notext" data-inline="true" title="Playlist">Playlist</a>'; footerHtml += '<a id="playlistButton" class="mediaButton playlistButton" href="playlist.html" data-role="button" data-icon="bullets" data-iconpos="notext" data-inline="true" title="Playlist">Playlist</a>';
footerHtml += '<button id="previousTrackButton" class="mediaButton previousTrackButton" title="Previous Track" type="button" onclick="MediaPlayer.previousTrack();" data-icon="previous-track" data-iconpos="notext" data-inline="true">Previous Track</button>'; footerHtml += '<button id="previousTrackButton" class="mediaButton previousTrackButton" title="Previous Track" type="button" onclick="MediaPlayer.previousTrack();" data-icon="previous-track" data-iconpos="notext" data-inline="true">Previous Track</button>';
@ -1351,10 +1372,12 @@ $(function () {
footerHtml += '</div>'; footerHtml += '</div>';
footerHtml += '<div id="footerNotifications"></div>'; footerHtml += '</div>';
footerHtml += '</div>'; footerHtml += '</div>';
footerHtml += '<div id="footerNotifications"></div>';
footerHtml += '</div>'; footerHtml += '</div>';
$(document.body).append(footerHtml); $(document.body).append(footerHtml);