mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add zoom and fade effect to video player
This commit is contained in:
parent
0a96f8e0bf
commit
604fba2cbf
8 changed files with 69 additions and 39 deletions
|
@ -39,6 +39,6 @@
|
||||||
"commit": "cec8e49744a1e18b14a711eea77e201bb70de544"
|
"commit": "cec8e49744a1e18b14a711eea77e201bb70de544"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/desandro/doc-ready.git",
|
"_source": "git://github.com/desandro/doc-ready.git",
|
||||||
"_target": "1.0.x",
|
"_target": "~1.0.4",
|
||||||
"_originalSource": "doc-ready"
|
"_originalSource": "doc-ready"
|
||||||
}
|
}
|
|
@ -33,14 +33,14 @@
|
||||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||||
},
|
},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"homepage": "https://github.com/polymerelements/iron-overlay-behavior",
|
"homepage": "https://github.com/PolymerElements/iron-overlay-behavior",
|
||||||
"_release": "1.1.1",
|
"_release": "1.1.1",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.1.1",
|
"tag": "v1.1.1",
|
||||||
"commit": "1ed1603ce820456feab3f62ae86f8f3ec801d131"
|
"commit": "1ed1603ce820456feab3f62ae86f8f3ec801d131"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
|
"_source": "git://github.com/PolymerElements/iron-overlay-behavior.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/iron-overlay-behavior"
|
"_originalSource": "PolymerElements/iron-overlay-behavior"
|
||||||
}
|
}
|
|
@ -50,7 +50,7 @@
|
||||||
"tag": "v1.1.1",
|
"tag": "v1.1.1",
|
||||||
"commit": "1bbce220b027dc030b294163f7da6f3e9052ab13"
|
"commit": "1bbce220b027dc030b294163f7da6f3e9052ab13"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/paper-input.git",
|
"_source": "git://github.com/PolymerElements/paper-input.git",
|
||||||
"_target": "^1.0.9",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/paper-input"
|
"_originalSource": "PolymerElements/paper-input"
|
||||||
}
|
}
|
|
@ -32,14 +32,14 @@
|
||||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
||||||
},
|
},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"homepage": "https://github.com/PolymerElements/paper-ripple",
|
"homepage": "https://github.com/polymerelements/paper-ripple",
|
||||||
"_release": "1.0.5",
|
"_release": "1.0.5",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.0.5",
|
"tag": "v1.0.5",
|
||||||
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/PolymerElements/paper-ripple.git",
|
"_source": "git://github.com/polymerelements/paper-ripple.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "PolymerElements/paper-ripple"
|
"_originalSource": "polymerelements/paper-ripple"
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
.videoBackdrop {
|
#mediaPlayer {
|
||||||
/* Allows popups to be closed, because their z-index is 1099 */
|
|
||||||
z-index: 1098;
|
z-index: 1098;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
dlg.open();
|
dlg.open();
|
||||||
}, 10);
|
}, 50);
|
||||||
|
|
||||||
// Has to be assigned a z-index after the call to .open()
|
// Has to be assigned a z-index after the call to .open()
|
||||||
dlg.addEventListener('iron-overlay-closed', function () {
|
dlg.addEventListener('iron-overlay-closed', function () {
|
||||||
|
|
|
@ -219,7 +219,7 @@
|
||||||
|
|
||||||
html += '</video>';
|
html += '</video>';
|
||||||
|
|
||||||
var elem = $('#videoElement', '#mediaPlayer').prepend(html);
|
var elem = $('#videoElement', '#videoPlayer').prepend(html);
|
||||||
|
|
||||||
return $('.itemVideo', elem)
|
return $('.itemVideo', elem)
|
||||||
.one('.loadedmetadata', onLoadedMetadata)
|
.one('.loadedmetadata', onLoadedMetadata)
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
self.exitFullScreen();
|
self.exitFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
fadeOut(document.querySelector('#mediaPlayer'));
|
fadeOut(document.querySelector('#videoPlayer'));
|
||||||
$('#videoPlayer').removeClass('fullscreenVideo').removeClass('idlePlayer');
|
$('#videoPlayer').removeClass('fullscreenVideo').removeClass('idlePlayer');
|
||||||
$('.hiddenOnIdle').removeClass("inactive");
|
$('.hiddenOnIdle').removeClass("inactive");
|
||||||
$("video").remove();
|
$("video").remove();
|
||||||
|
@ -52,18 +52,6 @@
|
||||||
document.querySelector('.videoControls').classList.add('hiddenOnIdle');
|
document.querySelector('.videoControls').classList.add('hiddenOnIdle');
|
||||||
};
|
};
|
||||||
|
|
||||||
function fadeOut(elem) {
|
|
||||||
$(elem).hide();
|
|
||||||
return;
|
|
||||||
var keyframes = [
|
|
||||||
{ opacity: '1', offset: 0 },
|
|
||||||
{ opacity: '0', offset: 1 }];
|
|
||||||
var timing = { duration: 300, iterations: 1 };
|
|
||||||
elem.animate(keyframes, timing).onfinish = function () {
|
|
||||||
$(elem).hide();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
self.exitFullScreen = function () {
|
self.exitFullScreen = function () {
|
||||||
|
|
||||||
if (document.exitFullscreen) {
|
if (document.exitFullscreen) {
|
||||||
|
@ -690,13 +678,9 @@
|
||||||
|
|
||||||
function ensureVideoPlayerElements() {
|
function ensureVideoPlayerElements() {
|
||||||
|
|
||||||
// TODO: remove dependency on nowplayingbar
|
var html = '';
|
||||||
require(['css!/css/nowplayingbar.css', 'css!/css/mediaplayer-video.css']);
|
|
||||||
|
|
||||||
var html = '<div id="mediaPlayer" style="display: none;">';
|
html += '<div id="videoPlayer" class="hide">';
|
||||||
|
|
||||||
html += '<div class="videoBackdrop">';
|
|
||||||
html += '<div id="videoPlayer">';
|
|
||||||
|
|
||||||
html += '<div id="videoElement">';
|
html += '<div id="videoElement">';
|
||||||
html += '<div id="play" class="status"></div>';
|
html += '<div id="play" class="status"></div>';
|
||||||
|
@ -758,8 +742,6 @@
|
||||||
html += '</div>'; // videoControls
|
html += '</div>'; // videoControls
|
||||||
|
|
||||||
html += '</div>'; // videoPlayer
|
html += '</div>'; // videoPlayer
|
||||||
html += '</div>'; // videoBackdrop
|
|
||||||
html += '</div>'; // mediaPlayer
|
|
||||||
|
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.innerHTML = html;
|
div.innerHTML = html;
|
||||||
|
@ -777,7 +759,7 @@
|
||||||
initComplete = true;
|
initComplete = true;
|
||||||
ensureVideoPlayerElements();
|
ensureVideoPlayerElements();
|
||||||
|
|
||||||
var parent = $("#mediaPlayer");
|
var parent = $("#videoPlayer");
|
||||||
|
|
||||||
muteButton = $('.muteButton', parent);
|
muteButton = $('.muteButton', parent);
|
||||||
unmuteButton = $('.unmuteButton', parent);
|
unmuteButton = $('.unmuteButton', parent);
|
||||||
|
@ -957,9 +939,10 @@
|
||||||
|
|
||||||
self.playVideo = function (item, mediaSource, startPosition, callback) {
|
self.playVideo = function (item, mediaSource, startPosition, callback) {
|
||||||
|
|
||||||
initVideoElements();
|
// TODO: remove dependency on nowplayingbar
|
||||||
|
requirejs(['videorenderer', 'css!/css/nowplayingbar.css', 'css!/css/mediaplayer-video.css'], function () {
|
||||||
|
|
||||||
requirejs(['videorenderer'], function () {
|
initVideoElements();
|
||||||
|
|
||||||
self.createStreamInfo('Video', item, mediaSource, startPosition).then(function (streamInfo) {
|
self.createStreamInfo('Video', item, mediaSource, startPosition).then(function (streamInfo) {
|
||||||
|
|
||||||
|
@ -988,6 +971,53 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function fadeOut(elem) {
|
||||||
|
|
||||||
|
if (elem.classList.contains('hide')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var onfinish = function () {
|
||||||
|
elem.classList.add('hide');
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!browserInfo.animate) {
|
||||||
|
onfinish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(function () {
|
||||||
|
var keyframes = [
|
||||||
|
{ opacity: '1', offset: 0 },
|
||||||
|
{ opacity: '0', offset: 1 }];
|
||||||
|
var timing = { duration: 400, iterations: 1, easing: 'ease-out' };
|
||||||
|
elem.animate(keyframes, timing).onfinish = onfinish;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fadeIn(elem) {
|
||||||
|
|
||||||
|
if (!elem.classList.contains('hide')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
elem.classList.remove('hide');
|
||||||
|
|
||||||
|
if (!browserInfo.animate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(function () {
|
||||||
|
|
||||||
|
var keyframes = [
|
||||||
|
{ transform: 'scale3d(.2, .2, .2) ', opacity: '.6', offset: 0 },
|
||||||
|
{ transform: 'none', opacity: '1', offset: 1 }
|
||||||
|
];
|
||||||
|
|
||||||
|
var timing = { duration: 240, iterations: 1, easing: 'ease-out' };
|
||||||
|
elem.animate(keyframes, timing);
|
||||||
|
});
|
||||||
|
}
|
||||||
self.playVideoInternal = function (item, mediaSource, startPosition, streamInfo, callback) {
|
self.playVideoInternal = function (item, mediaSource, startPosition, streamInfo, callback) {
|
||||||
|
|
||||||
self.startTimeTicksOffset = streamInfo.startTimeTicksOffset;
|
self.startTimeTicksOffset = streamInfo.startTimeTicksOffset;
|
||||||
|
@ -998,7 +1028,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create video player
|
// Create video player
|
||||||
var mediaPlayerContainer = $("#mediaPlayer").show();
|
var mediaPlayerContainer = document.querySelector('#videoPlayer');
|
||||||
|
fadeIn(mediaPlayerContainer);
|
||||||
var videoControls = $('.videoControls', mediaPlayerContainer);
|
var videoControls = $('.videoControls', mediaPlayerContainer);
|
||||||
|
|
||||||
//show stop button
|
//show stop button
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue