Updated embedded player, and fixes for chromecast on mobile

This commit is contained in:
Kasper Rynning-Tønnesen
2016-11-22 18:20:55 +01:00
parent db2887c610
commit 4592f4d7f9
7 changed files with 70 additions and 13 deletions

View File

@@ -5,6 +5,46 @@
<meta name="author" content="Nicolas 'Nixo' Almagro Tonne &amp; Kasper 'KasperRT' Rynning-Tønnesen"/> <meta name="author" content="Nicolas 'Nixo' Almagro Tonne &amp; Kasper 'KasperRT' Rynning-Tønnesen"/>
<meta name="description" content="The Shared (free) YouTube radio. Being built around the YouTube search and video API it enables the creation of collaborative and shared live playlists, with billions of videos and songs to choose from, all for free and without registration. Enjoy!"/> <meta name="description" content="The Shared (free) YouTube radio. Being built around the YouTube search and video API it enables the creation of collaborative and shared live playlists, with billions of videos and songs to choose from, all for free and without registration. Enjoy!"/>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<style>
#pageButtons, #pageButtons a{
color:white !important;
}
#pageNumber{
cursor: default;
color: white;
padding:0;
}
.prev_page, .next_page, .last_page, .first_page{
cursor: pointer;
}
.prev_page_hide, .next_page_hide, .last_page_hide, .first_page_hide{
visibility: visible !important;
color:gray;
cursor:default;
}
.prev_page_hide, .prev_page, .first_page, .first_page_hide{
padding:0 10px;
float:left;
}
.next_page_hide, .next_page, .last_page, .last_page_hide{
padding:0 10px;
float:right;
}
.last_page, .last_page_hide, .first_page, .first_page_hide{
display: none !important;
}
#wrapper{
height: 94%;
}
</style>
</head> </head>
<body> <body>
<script> <script>

View File

@@ -1652,7 +1652,7 @@ nav ul li:hover, nav ul li.active {
font-size: 31px; font-size: 31px;
} }
.castButton, .castButton-active{ .castButton, .castButton:active, .castButton:focus, .castButton:hover, .castButton-active, .castButton-active:active, .castButton-active:hover, .castButton-active:focus{
font-size: 28px; font-size: 28px;
margin: 0 33px 0 0px; margin: 0 33px 0 0px;
} }
@@ -1719,7 +1719,7 @@ nav ul li:hover, nav ul li.active {
margin-top:-6px; margin-top:-6px;
} }
.click-through{ #player{
pointer-events:none; pointer-events:none;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -10,6 +10,7 @@ var vol = 100;
var adminpass = ""; var adminpass = "";
var mobile_beginning = false; var mobile_beginning = false;
var durationBegun = false; var durationBegun = false;
var chromecastAvailable = false;
var seekTo; var seekTo;
var socket; var socket;
@@ -36,7 +37,7 @@ $(document).ready(function(){
$("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" />');
add = "https://zoff.no"; add = "http://localhost";
socket = io.connect(''+add+':8880', connection_options); socket = io.connect(''+add+':8880', connection_options);
socket.on("get_list", function(){ socket.on("get_list", function(){

View File

@@ -244,6 +244,7 @@ function init(){
} }
initializeCastApi = function() { initializeCastApi = function() {
$(".castButton").css("display", "block");
cast.framework.CastContext.getInstance().setOptions({ cast.framework.CastContext.getInstance().setOptions({
receiverApplicationId: "E6856E24", receiverApplicationId: "E6856E24",
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}); autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED});
@@ -258,7 +259,13 @@ initializeCastApi = function() {
chromecastAvailable = true; chromecastAvailable = true;
paused = false; paused = false;
mobile_beginning = false; mobile_beginning = false;
castSession.sendMessage("urn:x-cast:zoff.no", {type: "loadVideo", videoId: video_id, seekTo: Player.player.getCurrentTime()}) var _seekTo;
try{
_seekTo = Player.player.getCurrentTime();
} catch(e){
_seekTo = seekTo;
}
castSession.sendMessage("urn:x-cast:zoff.no", {type: "loadVideo", videoId: video_id, seekTo: _seekTo})
castSession.sendMessage("urn:x-cast:zoff.no", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title}) castSession.sendMessage("urn:x-cast:zoff.no", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title})
hide_native(1); hide_native(1);
break; break;
@@ -268,7 +275,13 @@ initializeCastApi = function() {
chromecastAvailable = true; chromecastAvailable = true;
paused = false; paused = false;
mobile_beginning = false; mobile_beginning = false;
castSession.sendMessage("urn:x-cast:zoff.no", {type: "loadVideo", videoId: video_id, seekTo: Player.player.getCurrentTime()}) var _seekTo;
try{
_seekTo = Player.player.getCurrentTime();
} catch(e){
_seekTo = seekTo;
}
castSession.sendMessage("urn:x-cast:zoff.no", {type: "loadVideo", videoId: video_id, seekTo: _seekTo})
castSession.sendMessage("urn:x-cast:zoff.no", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title}) castSession.sendMessage("urn:x-cast:zoff.no", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title})
hide_native(1); hide_native(1);
break; break;
@@ -290,7 +303,9 @@ function hide_native(way){
$("#fullscreen").toggleClass("hide"); $("#fullscreen").toggleClass("hide");
$("#volume-button").toggleClass("hide"); $("#volume-button").toggleClass("hide");
$("#volume").toggleClass("hide"); $("#volume").toggleClass("hide");
try{
Player.player.stopVideo(); Player.player.stopVideo();
} catch(e){}
Player.stopInterval = true; Player.stopInterval = true;
//$("#player").toggleClass("hide"); //$("#player").toggleClass("hide");
$("#player_overlay").removeClass("hide"); $("#player_overlay").removeClass("hide");

View File

@@ -35,6 +35,7 @@ var Player = {
Player.getTitle(obj.np[0].title, viewers); Player.getTitle(obj.np[0].title, viewers);
//Player.setBGimage(video_id); //Player.setBGimage(video_id);
if(!Helper.mobilecheck()) Player.notifyUser(obj.np[0].id, obj.np[0].title); if(!Helper.mobilecheck()) Player.notifyUser(obj.np[0].id, obj.np[0].title);
console.log("trying to stop");
Player.stopVideo(); Player.stopVideo();
}else if(!paused){ }else if(!paused){
//Helper.log("gotten new song"); //Helper.log("gotten new song");
@@ -261,9 +262,9 @@ var Player = {
Player.durationSetter(); Player.durationSetter();
if(embed){ if(embed){
setTimeout(function(){ setTimeout(function(){
Player.seekTo(seekTo); Player.player.seekTo(seekTo);
if(!autoplay){ if(!autoplay){
Player.pauseVideo(); Player.player.pauseVideo();
Playercontrols.play_pause_show(); Playercontrols.play_pause_show();
} }
}, 1000); }, 1000);