mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-29 13:31:00 +00:00
Added option for autoplay in embed
This commit is contained in:
@@ -158,7 +158,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<h4>Embed code (in beta)</h4>
|
<h4>Embed code (in beta)</h4>
|
||||||
<p>Copy the code in the textarea, and paste on your website.</p>
|
<p>Copy the code in the textarea, and paste on your website. Remove the & and autoplay, to prevent the player to autoplay.</p>
|
||||||
<textarea id="embed-area"></textarea>
|
<textarea id="embed-area"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -150,7 +150,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<h4>Embed code (in beta)</h4>
|
<h4>Embed code (in beta)</h4>
|
||||||
<p>Copy the code in the textarea, and paste on your website.</p>
|
<p>Copy the code in the textarea, and paste on your website. Remove the & and autoplay, to prevent the player to autoplay.</p>
|
||||||
<textarea id="embed-area"></textarea>
|
<textarea id="embed-area"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
2
static/dist/embed.min.js
vendored
2
static/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
4
static/dist/main.min.js
vendored
4
static/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -13,7 +13,9 @@ var seekTo;
|
|||||||
var socket;
|
var socket;
|
||||||
var video_id;
|
var video_id;
|
||||||
var previous_video_id;
|
var previous_video_id;
|
||||||
var chan = window.location.hash.substring(1);
|
var hash = window.location.hash.substring(1).split("&");
|
||||||
|
var chan = hash[0];
|
||||||
|
var autoplay = false;
|
||||||
|
|
||||||
var connection_options = {
|
var connection_options = {
|
||||||
'sync disconnect on unload':true,
|
'sync disconnect on unload':true,
|
||||||
@@ -23,6 +25,11 @@ var connection_options = {
|
|||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
if(hash.length == 2 && hash[1] == "autoplay"){
|
||||||
|
autoplay = true;
|
||||||
|
paused = true;
|
||||||
|
}
|
||||||
|
|
||||||
$("head").append('<link type="text/css" rel="stylesheet" href="/static/css/embed.css" />');
|
$("head").append('<link type="text/css" rel="stylesheet" href="/static/css/embed.css" />');
|
||||||
$("head").append('<link type="text/css" rel="stylesheet" href="/static/css/materialize.min.css" />');
|
$("head").append('<link type="text/css" rel="stylesheet" href="/static/css/materialize.min.css" />');
|
||||||
|
|
||||||
@@ -33,10 +40,10 @@ $(document).ready(function(){
|
|||||||
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
|
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Youtube.setup_youtube_listener(chan);
|
Youtube.setup_youtube_listener(chan);
|
||||||
List.channel_listener();
|
List.channel_listener();
|
||||||
|
|
||||||
|
|
||||||
window.onYouTubeIframeAPIReady = Youtube.onYouTubeIframeAPIReady;
|
window.onYouTubeIframeAPIReady = Youtube.onYouTubeIframeAPIReady;
|
||||||
|
|
||||||
Youtube.loadPlayer();
|
Youtube.loadPlayer();
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ var began = false;
|
|||||||
var i = -1;
|
var i = -1;
|
||||||
var lazy_load = true;
|
var lazy_load = true;
|
||||||
var embed = false;
|
var embed = false;
|
||||||
|
var autoplay = true;
|
||||||
|
|
||||||
var id;
|
var id;
|
||||||
var full_playlist;
|
var full_playlist;
|
||||||
@@ -191,7 +192,7 @@ function init(){
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
$("#embed-button").css("display", "inline-block");
|
$("#embed-button").css("display", "inline-block");
|
||||||
$("#embed-area").val('<embed src="https://zoff.no/embed.html#' + chan.toLowerCase() + '" width="600px" height="300px">');
|
$("#embed-area").val('<embed src="https://zoff.no/embed.html#' + chan.toLowerCase() + '&autplay" width="600px" height="300px">');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,14 @@ var Playercontrols = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
play_pause_show: function()
|
||||||
|
{
|
||||||
|
if(document.getElementById("pause").className.split(" ").length == 1)
|
||||||
|
$("#pause").toggleClass("hide");
|
||||||
|
if(document.getElementById("play").className.split(" ").length == 2)
|
||||||
|
$("#play").toggleClass("hide");
|
||||||
|
},
|
||||||
|
|
||||||
settings: function()
|
settings: function()
|
||||||
{
|
{
|
||||||
$("#qS").toggleClass("hide");
|
$("#qS").toggleClass("hide");
|
||||||
|
|||||||
@@ -111,10 +111,7 @@ var Youtube = {
|
|||||||
case 2:
|
case 2:
|
||||||
paused = true;
|
paused = true;
|
||||||
|
|
||||||
if(document.getElementById("pause").className.split(" ").length == 1)
|
Playercontrols.play_pause_show();
|
||||||
$("#pause").toggleClass("hide");
|
|
||||||
if(document.getElementById("play").className.split(" ").length == 2)
|
|
||||||
$("#play").toggleClass("hide");
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
break;
|
break;
|
||||||
@@ -173,11 +170,15 @@ var Youtube = {
|
|||||||
$("#controls").css("opacity", "1");
|
$("#controls").css("opacity", "1");
|
||||||
$(".playlist").css("opacity", "1");
|
$(".playlist").css("opacity", "1");
|
||||||
Youtube.ytplayer.loadVideoById(video_id);
|
Youtube.ytplayer.loadVideoById(video_id);
|
||||||
Youtube.ytplayer.playVideo();
|
if(autoplay) Youtube.ytplayer.playVideo();
|
||||||
Youtube.durationSetter();
|
Youtube.durationSetter();
|
||||||
if(embed){
|
if(embed){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
Youtube.ytplayer.seekTo(seekTo);
|
Youtube.ytplayer.seekTo(seekTo);
|
||||||
|
if(!autoplay){
|
||||||
|
Youtube.ytplayer.pauseVideo();
|
||||||
|
Playercontrols.play_pause_show();
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}else
|
}else
|
||||||
Youtube.ytplayer.seekTo(seekTo);
|
Youtube.ytplayer.seekTo(seekTo);
|
||||||
|
|||||||
Reference in New Issue
Block a user