mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added functionality for offline playing
This commit is contained in:
@@ -1633,6 +1633,13 @@ nav ul li:hover, nav ul li.active {
|
||||
}
|
||||
|
||||
|
||||
#offline-info{
|
||||
color: black;
|
||||
line-height: 20px;
|
||||
margin: 0 24px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
****************************************************************************
|
||||
********************* Screen size specific rules ***************************
|
||||
|
||||
4
public/dist/embed.min.js
vendored
4
public/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
8
public/dist/main.min.js
vendored
8
public/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
2
public/dist/remote.min.js
vendored
2
public/dist/remote.min.js
vendored
@@ -1 +1 @@
|
||||
!function(){var e=!0;mobilecheck=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},$(document).ready(function(){document.title="Zöff Remote",setTimeout(function(){$("#search").focus()},500);var e={"sync disconnect on unload":!0,secure:!0};"remote.zoff.no"==window.location.hostname?add="https://zoff.no":add="localhost",socket=io.connect(add+":8080",e),id=window.location.pathname.split("/")[1],id&&(id=id.toLowerCase(),t.control()),git_info=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,git_info=$.parseJSON(git_info),$("#latest-commit").html("Latest Commit: <br>"+git_info[0].commit.author.date.substring(0,10)+": "+git_info[0].committer.login+"<br><a href='"+git_info[0].html_url+"'>"+git_info[0].sha.substring(0,10)+"</a>: "+git_info[0].commit.message+"<br")}),$("#playbutton").on("click",function(){socket.emit("id",{id:id,type:"play",value:"mock"})}),$("#pausebutton").on("click",function(){socket.emit("id",{id:id,type:"pause",value:"mock"})}),$("#skipbutton").on("click",function(){socket.emit("id",{id:id,type:"skip",value:"mock"})}),$("#remoteform").on("submit",function(){t.control()});var t={control:function(){e?(id||(id=document.getElementById("remoteform").chan.value,window.history.pushState("object or string","Title","/"+id)),document.getElementById("remoteform").chan.value="",e=!1,$(".rc").css("display","block"),$("#remote-text").text("Controlling "+id.toUpperCase()),document.getElementById("search").setAttribute("length","18"),document.getElementById("search").setAttribute("maxlength","18"),$("#forsearch").html("Type new channel name to change to"),$("#volume-control").slider({min:0,max:100,value:100,range:"min",animate:!0,stop:function(e,t){socket.emit("id",{id:id,type:"volume",value:t.value}),console.log("volume")}})):(socket.emit("id",{id:id,type:"channel",value:$("#search").val().toLowerCase()}),$("#search").val(""))}}}();
|
||||
!function(){var e=!0;mobilecheck=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},$(document).ready(function(){document.title="Zöff Remote",setTimeout(function(){$("#search").focus()},500);var e={"sync disconnect on unload":!0,secure:!0};"remote.zoff.no"==window.location.hostname?add="https://zoff.no":add="localhost",socket=io.connect(add+":8080",e),id=window.location.pathname.split("/")[1],id&&(id=id.toLowerCase(),t.control()),git_info=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,git_info=$.parseJSON(git_info),$("#latest-commit").html("Latest Commit: <br>"+git_info[0].commit.author.date.substring(0,10)+": "+git_info[0].committer.login+"<br><a href='"+git_info[0].html_url+"'>"+git_info[0].sha.substring(0,10)+"</a>: "+git_info[0].commit.message+"<br")}),$("#playbutton").on("click",function(){socket.emit("id",{id:id,type:"play",value:"mock"})}),$("#pausebutton").on("click",function(){socket.emit("id",{id:id,type:"pause",value:"mock"})}),$("#skipbutton").on("click",function(){socket.emit("id",{id:id,type:"skip",value:"mock"})}),$("#remoteform").on("submit",function(){t.control()});var t={control:function(){e?(id||(id=document.getElementById("remoteform").chan.value,window.history.pushState("object or string","Title","/"+id)),document.getElementById("remoteform").chan.value="",e=!1,$(".rc").css("display","block"),$("#remote-text").text("Controlling "+id.toUpperCase()),document.getElementById("search").setAttribute("length","18"),document.getElementById("search").setAttribute("maxlength","18"),$("#forsearch").html("Type new channel name to change to"),$("#volume-control").slider({min:0,max:100,value:100,range:"min",animate:!0,stop:function(e,t){socket.emit("id",{id:id,type:"volume",value:t.value})}})):(socket.emit("id",{id:id,type:"channel",value:$("#search").val().toLowerCase()}),$("#search").val(""))}}}();
|
||||
@@ -102,7 +102,6 @@ var Admin = {
|
||||
|
||||
conf: function(msg)
|
||||
{
|
||||
Crypt.init();
|
||||
Admin.set_conf(msg[0]);
|
||||
if(Crypt.get_pass(chan.toLowerCase()) !== undefined && Admin.beginning && Crypt.get_pass(chan.toLowerCase()) !== ""){
|
||||
socket.emit("password", {password: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase())), channel: chan.toLowerCase()});
|
||||
|
||||
@@ -4,25 +4,31 @@ var Crypt = {
|
||||
|
||||
init: function(){
|
||||
|
||||
if(window.location.pathname != "/"){
|
||||
if (location.protocol != "https:"){
|
||||
document.cookie = chan.toLowerCase() + '=;path=/' + chan.toLowerCase() + ';expires=' + new Date(0).toUTCString();
|
||||
} else {
|
||||
document.cookie = chan.toLowerCase() + '=;path=/' + chan.toLowerCase() + ';secure;expires=' + new Date(0).toUTCString();
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
conf_arr = Crypt.decrypt(Crypt.getCookie("_opt"), "_opt");
|
||||
}catch(err){
|
||||
conf_arr = Crypt.decrypt(Crypt.create_cookie("_opt"), "_opt");
|
||||
}
|
||||
|
||||
if(window.location.pathname != "/"){
|
||||
try{
|
||||
Crypt.conf_pass = Crypt.decrypt(Crypt.getCookie(chan.toLowerCase()), chan.toLowerCase());
|
||||
}catch(err){
|
||||
Crypt.conf_pass = Crypt.decrypt(Crypt.create_cookie(chan.toLowerCase()), chan.toLowerCase());
|
||||
}
|
||||
|
||||
Hostcontroller.change_enabled(conf_arr.remote);
|
||||
if(conf_arr.width != 100) Player.set_width(conf_arr.width);
|
||||
if(conf_arr.name !== undefined && conf_arr.name !== "") Chat.namechange(conf_arr.name);
|
||||
}
|
||||
},
|
||||
|
||||
decrypt: function(cookie, name){
|
||||
@@ -91,13 +97,23 @@ var Crypt = {
|
||||
//return conf_arr.volume;
|
||||
},
|
||||
|
||||
get_offline: function(){
|
||||
var temp_offline = Crypt.decrypt(Crypt.getCookie("_opt"), "_opt").offline;
|
||||
if(temp_offline != undefined){
|
||||
return Crypt.decrypt(Crypt.getCookie("_opt"), "_opt").offline;
|
||||
} else {
|
||||
Crypt.set_offline(false);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
set_volume: function(val){
|
||||
conf_arr.volume = val;
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
create_cookie: function(name){
|
||||
if(name == "_opt") cookie_object = {volume: 100, width: 100, remote: true, name: ""};
|
||||
if(name == "_opt") cookie_object = {volume: 100, width: 100, remote: true, name: "", offline: false};
|
||||
else cookie_object = {passwords: {}};
|
||||
|
||||
var string_it = JSON.stringify(cookie_object);
|
||||
@@ -139,6 +155,11 @@ var Crypt = {
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
set_offline: function(enabled){
|
||||
conf_arr.offline = enabled;
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
remove_name:function(){
|
||||
conf_arr.name = "";
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
|
||||
@@ -97,7 +97,6 @@ var Frontpage = {
|
||||
$("#channels").append(card.html());
|
||||
|
||||
//$("#channels").append(card);
|
||||
//console.log(chan);
|
||||
}
|
||||
output+="<option value='"+chan+"'> ";
|
||||
num++;
|
||||
@@ -263,7 +262,7 @@ var Frontpage = {
|
||||
window.history.pushState("to the channel!", "Title", "/" + new_channel);
|
||||
window.chan = new_channel;
|
||||
}
|
||||
console.log(chromecastReady);
|
||||
|
||||
var response = $("<div>" + e + "</div>");
|
||||
|
||||
$(".mega").remove();
|
||||
@@ -286,6 +285,7 @@ var Frontpage = {
|
||||
}
|
||||
$("#search").attr("placeholder", "Find song on YouTube...");
|
||||
$(".page-footer").addClass("padding-bottom-novideo");
|
||||
from_frontpage = true;
|
||||
if($("#alreadychannel").length == 1){
|
||||
init();
|
||||
}else{
|
||||
@@ -352,6 +352,11 @@ function initfp(){
|
||||
Helper.log("Socket", socket);
|
||||
Helper.log("-----");
|
||||
|
||||
Crypt.init();
|
||||
if(Crypt.get_offline()){
|
||||
change_offline(true);
|
||||
}
|
||||
|
||||
socket.emit('frontpage_lists');
|
||||
|
||||
$("#channel-load").css("display", "none");
|
||||
|
||||
@@ -10,7 +10,6 @@ var List = {
|
||||
|
||||
channel_function: function(msg)
|
||||
{
|
||||
|
||||
switch(msg.type)
|
||||
{
|
||||
case "list":
|
||||
@@ -391,12 +390,20 @@ var List = {
|
||||
},
|
||||
|
||||
vote: function(id, vote){
|
||||
if(!offline){
|
||||
socket.emit('vote', {channel: chan, id: id, type: vote, adminpass: adminpass});
|
||||
} else {
|
||||
List.channel_function({type:"vote", value: id, time: (new Date()).getTime()})
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
skip: function(){
|
||||
if(!offline){
|
||||
socket.emit('skip', {pass: adminpass, id:video_id, channel: chan.toLowerCase()});
|
||||
} else {
|
||||
Player.playNext();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ var durationBegun = false;
|
||||
var chat_active = false;
|
||||
var chat_unseen = false;
|
||||
var blinking = false;
|
||||
var from_frontpage = false;
|
||||
var access_token_data = {};
|
||||
var spotify_authenticated = false;
|
||||
var not_import_html = "";
|
||||
@@ -42,6 +43,7 @@ var chromecastAvailable = false;
|
||||
var color = "808080";
|
||||
var find_start = false;
|
||||
var find_started = false;
|
||||
var offline = false;
|
||||
var chromecastReady = false;
|
||||
var found_array = [];
|
||||
var found_array_index = 0;
|
||||
@@ -193,6 +195,12 @@ function init(){
|
||||
socket = io.connect(''+add+':8080', connection_options);
|
||||
}
|
||||
|
||||
Crypt.init();
|
||||
if(Crypt.get_offline()){
|
||||
$(".offline_switch_class")[0].checked = true;
|
||||
change_offline(true);
|
||||
}
|
||||
|
||||
if($("#alreadychannel").length === 0 || Helper.mobilecheck()){
|
||||
setup_youtube_listener();
|
||||
get_list_listener();
|
||||
@@ -221,7 +229,6 @@ function init(){
|
||||
|
||||
//if(/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){
|
||||
/*if(!Helper.mobilecheck() && !window.MSStream){
|
||||
console.log("asd");
|
||||
document.getElementById("search").blur();
|
||||
$("#channel-load").css("display", "none");
|
||||
} else {*/
|
||||
@@ -234,6 +241,7 @@ function init(){
|
||||
setup_admin_listener();
|
||||
setup_list_listener();
|
||||
setup_chat_listener();
|
||||
|
||||
if(!Helper.mobilecheck() && $("#alreadychannel").length === 0) setup_host_initialization();
|
||||
|
||||
if(!Helper.msieversion() && !Helper.mobilecheck()) Notification.requestPermission();
|
||||
@@ -485,6 +493,46 @@ function randomString(length){
|
||||
return text;
|
||||
}
|
||||
|
||||
function change_offline(enabled){
|
||||
Crypt.set_offline(enabled);
|
||||
offline = enabled;
|
||||
socket.emit("offline", enabled);
|
||||
if(enabled){
|
||||
if(list_html){
|
||||
list_html = $("<div>" + list_html + "</div>");
|
||||
list_html.find(".card-content").css("display", "flex");
|
||||
list_html.find(".card-content").css("height", "100%");
|
||||
list_html.find(".list-title").css("align-self", "center");
|
||||
list_html.find(".vote-span").addClass("hide");
|
||||
list_html = list_html.html();
|
||||
}
|
||||
$(".card-content").css("display", "flex");
|
||||
$(".card-content").css("height", "100%");
|
||||
$(".list-title").css("align-self", "center");
|
||||
$(".vote-span").addClass("hide");
|
||||
$("#viewers").addClass("hide");
|
||||
$("#offline-mode").removeClass("waves-cyan");
|
||||
$("#offline-mode").addClass("cyan");
|
||||
} else {
|
||||
if(list_html){
|
||||
list_html = $("<div>" + list_html + "</div>");
|
||||
list_html.find(".card-content").css("display", "block");
|
||||
list_html.find(".card-content").css("height", "initial");
|
||||
list_html.find(".list-title").css("align-self", "center");
|
||||
list_html.find(".vote-span").removeClass("hide");
|
||||
list_html = list_html.html();
|
||||
}
|
||||
$(".card-content").css("display", "block");
|
||||
$(".card-content").css("height", "initial");
|
||||
$(".list-title").css("align-self", "center");
|
||||
$(".vote-span").removeClass("hide");
|
||||
$("#viewers").removeClass("hide");
|
||||
$("#offline-mode").addClass("waves-cyan");
|
||||
$("#offline-mode").removeClass("cyan");
|
||||
socket.emit("pos");
|
||||
}
|
||||
}
|
||||
|
||||
function spotify_is_authenticated(bool){
|
||||
if(bool){
|
||||
Helper.log("------------------------");
|
||||
@@ -526,6 +574,15 @@ $(document).keyup(function(e) {
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("click", "#offline-mode", function(){
|
||||
if(!Crypt.get_offline()){
|
||||
change_offline(true);
|
||||
} else{
|
||||
change_offline(false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on("click", "#playpause-overlay", function(){
|
||||
if($("#play-overlay").hasClass("hide")){
|
||||
Player.pauseVideo();
|
||||
@@ -682,6 +739,13 @@ $(document).on("change", 'input[class=remote_switch_class]', function()
|
||||
Crypt.set_remote(enabled);
|
||||
});
|
||||
|
||||
$(document).on("change", 'input[class=offline_switch_class]', function()
|
||||
{
|
||||
//Hostcontroller.change_enabled(document.getElementsByName("remote_switch")[0].checked);
|
||||
offline = document.getElementsByName("offline_switch")[0].checked;
|
||||
change_offline(offline);
|
||||
});
|
||||
|
||||
$(document).on("change", 'input[class=conf]', function()
|
||||
{
|
||||
Admin.save();
|
||||
@@ -1166,6 +1230,7 @@ function onepage_load(){
|
||||
var url_split = window.location.href.split("/");
|
||||
|
||||
if(url_split[3].substr(0,1) != "#!" && url_split[3] !== "" && !(url_split.length == 5 && url_split[4].substr(0,1) == "#")){
|
||||
|
||||
socket.emit("change_channel");
|
||||
Admin.beginning = true;
|
||||
|
||||
|
||||
@@ -8,9 +8,16 @@ var Player = {
|
||||
|
||||
youtube_listener: function(obj)
|
||||
{
|
||||
var state;
|
||||
try{
|
||||
state = Player.player.getPlayerState();
|
||||
}catch(e){
|
||||
state = null;
|
||||
}
|
||||
if((!offline && (state || from_frontpage)) || (offline && (!state || from_frontpage))|| (!offline && (!state || from_frontpage))){
|
||||
from_frontpage = false;
|
||||
Player.loaded = false;
|
||||
Helper.log("--------youtube_listener--------");
|
||||
|
||||
Helper.log("Received: ");
|
||||
Helper.log(obj);
|
||||
Helper.log("paused variable: " + paused);
|
||||
@@ -104,6 +111,10 @@ var Player = {
|
||||
else
|
||||
Player.getTitle(song_title, viewers);
|
||||
}
|
||||
} else {
|
||||
if(!durationBegun)
|
||||
Player.durationSetter();
|
||||
}
|
||||
},
|
||||
|
||||
onPlayerStateChange: function(newState) {
|
||||
@@ -123,7 +134,11 @@ var Player = {
|
||||
case 0:
|
||||
playing = false;
|
||||
paused = false;
|
||||
if(!offline){
|
||||
socket.emit("end", {id: video_id, channel: chan.toLowerCase()});
|
||||
} else {
|
||||
Player.playNext();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
|
||||
@@ -146,7 +161,7 @@ var Player = {
|
||||
if(document.getElementById("pause").className.split(" ").length == 2)
|
||||
$("#pause").toggleClass("hide");
|
||||
}
|
||||
if(paused)
|
||||
if(paused && !offline)
|
||||
{
|
||||
socket.emit('pos', {channel: chan.toLowerCase()});
|
||||
paused = false;
|
||||
@@ -202,8 +217,10 @@ var Player = {
|
||||
seekTo: function(_seekTo){
|
||||
if(chromecastAvailable){
|
||||
castSession.sendMessage("urn:x-cast:zoff.no", {type: "seekTo", seekTo: _seekTo});
|
||||
} else {
|
||||
} else if(!offline){
|
||||
Player.player.seekTo(_seekTo);
|
||||
} else {
|
||||
Player.player.seekTo(0);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -233,6 +250,18 @@ var Player = {
|
||||
}
|
||||
},
|
||||
|
||||
playNext: function(){
|
||||
var next_song = full_playlist[0];
|
||||
video_id = next_song.id;
|
||||
time = (new Date()).getTime();
|
||||
song_title = next_song.title;
|
||||
duration = next_song.duration;
|
||||
Player.getTitle(song_title, viewers);
|
||||
Player.setBGimage(video_id);
|
||||
Player.loadVideoById(video_id);
|
||||
List.channel_function({type:"song_change", time: time});
|
||||
},
|
||||
|
||||
sendNext: function(obj){
|
||||
if(chromecastAvailable){
|
||||
castSession.sendMessage("urn:x-cast:zoff.no", {type: "nextVideo", title: obj.title, videoId: obj.videoId});
|
||||
|
||||
@@ -97,7 +97,6 @@ var Remotecontroller = {
|
||||
},*/
|
||||
stop:function(event, ui) {
|
||||
socket.emit("id", {id: id, type: "volume", value: ui.value});
|
||||
console.log("volume");
|
||||
//console.log(ui.value);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,6 +22,7 @@ if(isset($_GET['chan'])){
|
||||
<span id="frontpage-viewer-counter" class="hide-on-small-only noselect" title="Divided among all channels. Hidden or not"></span>
|
||||
<!--<a href="//zoff.no" class="brand-logo brand-mobile hide-on-med-and-up">Zöff</a>-->
|
||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||
<li><a class="waves-effect waves-cyan" id="offline-mode" title="Offline mode" href="#">Offline</a></li>
|
||||
<li><a class="waves-effect waves-green" title="Remote control a Zöff player" href="https://remote.zoff.no">Remote</a></li>
|
||||
<li><a class="modal-trigger waves-effect waves-red" title="Need help with the site?" onclick="$('#help').openModal()">Help</a></li>
|
||||
<li><a class="modal-trigger waves-effect waves-orange" onclick="$('#about').openModal()">About</a></li>
|
||||
|
||||
@@ -130,6 +130,33 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="no-padding offline-panel hide-on-small-only">
|
||||
<ul class="collapsible collapsible-accordion">
|
||||
<li>
|
||||
<a class="collapsible-header bold waves-effect">Offline Mode
|
||||
<i class="mdi-device-signal-wifi-statusbar-connected-no-internet-"></i>
|
||||
</a>
|
||||
<div class="collapsible-body">
|
||||
<ul>
|
||||
<li>
|
||||
<span class="switch-text">
|
||||
Enable Local
|
||||
</span>
|
||||
<div class="switch"><label>
|
||||
Disabled
|
||||
<input name="offline_switch" type="checkbox" class="offline_switch_class" /><span class="lever"></span>
|
||||
Enabled
|
||||
</label>
|
||||
</div>
|
||||
<div id="offline-info">
|
||||
By enabling local/offline, you won't receive updates in position of the currently playing song, and you'll be able to vote as many times as you please.
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="no-padding hide-on-small-only">
|
||||
<ul class="collapsible collapsible-accordion">
|
||||
|
||||
Reference in New Issue
Block a user