Fix Mini player autoplay

This commit is contained in:
PrestonN 2019-03-26 10:48:43 -04:00
parent 3e7f4a606f
commit b32990dc2d
3 changed files with 9 additions and 5 deletions

View File

@ -38,7 +38,9 @@ let win;
protocol.registerStandardSchemes(['freetube']);
app.setAsDefaultProtocolClient('freetube');
app.setAsDefaultProtocolClient('freetube');//--autoplay-policy=no-user-gesture-required
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');
const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
@ -167,7 +169,7 @@ let init = function () {
/**
* Sets proxy when setProxy event is sent from renderer
*
*
* example data "SOCKS5://127.0.0.1:9050"
*/
ipcMain.on("setProxy", (_e, data) => {

View File

@ -320,8 +320,8 @@ function openMiniPlayer() {
$.get('templates/miniPlayer.html', (template) => {
mustache.parse(template);
const rendered = mustache.render(template, {
videoHtml: videoHtml,
videoThumbnail: playerView.thumbnail,
videoUrl: playerView.videoUrl,
videoThumbnail: playerView.videoThumbnail,
startTime: lastTime,
});
// Render the template to the new browser window.

View File

@ -39,6 +39,7 @@ let mouseTimeout;
$('.videoPlayer').ready(() => {
$('.videoPlayer').get(0).currentTime = startTime;
$('.videoPlayer').get(0).play();
});
/**
@ -75,4 +76,5 @@ $(document).on('mouseover', '.videoPlayer', hideMouseTimeout);
$(document).on('mouseleave', '.videoPlayer', removeMouseTimeout);
</script>
{{{videoHtml}}}
<video class="videoPlayer" id='videoPlayer' type="application/x-mpegURL" object-fit='cover' onmousemove="hideMouseTimeout()" onmouseleave="removeMouseTimeout()" controls="" src='{{videoUrl}}' poster='{{videoThumbnail}}' autoplay="autoplay">
</video>