mirror of https://github.com/FreeTubeApp/FreeTube
79 lines
2.0 KiB
HTML
79 lines
2.0 KiB
HTML
<!--
|
|
This file is part of FreeTube.
|
|
|
|
FreeTube is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
FreeTube is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with FreeTube. If not, see <http://www.gnu.org/licenses/>.
|
|
-->
|
|
|
|
<title>Freetube Mini-Player</title>
|
|
<style>
|
|
body {
|
|
background-color: #424242;
|
|
}
|
|
|
|
.videoPlayer {
|
|
width: 100%;
|
|
}
|
|
|
|
iframe {
|
|
width: 100%;
|
|
height: 54.9vw;
|
|
}
|
|
|
|
</style>
|
|
<script src="../js/events.js"></script>
|
|
<script>
|
|
window.$ = window.jQuery = require('jquery');
|
|
let startTime = '{{startTime}}';
|
|
let mouseTimeout;
|
|
|
|
$('.videoPlayer').ready(() => {
|
|
$('.videoPlayer').get(0).currentTime = startTime;
|
|
});
|
|
|
|
/**
|
|
* Hide the mouse cursor after ~3 seconds. Used to hide the video when the user
|
|
* hovers the mouse over the video player.
|
|
*
|
|
* @return {Void}
|
|
*/
|
|
function hideMouseTimeout() {
|
|
$('.videoPlayer')[0].style.cursor = 'default';
|
|
clearTimeout(mouseTimeout);
|
|
mouseTimeout = window.setTimeout(function() {
|
|
$('.videoPlayer')[0].style.cursor = 'none';
|
|
}, 3150);
|
|
}
|
|
|
|
/**
|
|
* Remove the timeout for the mouse cursor as a fallback.
|
|
*
|
|
* @return {Void}
|
|
*/
|
|
function removeMouseTimeout() {
|
|
$('.videoPlayer')[0].style.cursor = 'default';
|
|
clearTimeout(mouseTimeout);
|
|
}
|
|
|
|
let playPauseVideo = function(event) {
|
|
let el = event.currentTarget;
|
|
el.paused ? el.play() : el.pause();
|
|
}
|
|
|
|
$(document).on('click', '.videoPlayer', playPauseVideo);
|
|
$(document).on('mouseover', '.videoPlayer', hideMouseTimeout);
|
|
$(document).on('mouseleave', '.videoPlayer', removeMouseTimeout);
|
|
|
|
</script>
|
|
{{{videoHtml}}}
|