mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Now sending next video to chromecast
This commit is contained in:
@@ -36,10 +36,39 @@
|
|||||||
.hide{
|
.hide{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#next_song{
|
||||||
|
display:none;
|
||||||
|
position: absolute;
|
||||||
|
background: rgba(255,255,255,0.2);
|
||||||
|
right: 10px;
|
||||||
|
bottom: 10px;
|
||||||
|
border: 1px solid white;
|
||||||
|
width: 15rem;
|
||||||
|
height: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#next_pic{
|
||||||
|
height: 7rem;
|
||||||
|
width: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#next_title{
|
||||||
|
position: absolute;
|
||||||
|
top: 45%;
|
||||||
|
right: 0px;
|
||||||
|
width: 8rem;
|
||||||
|
overflow: hidden;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
|
<div id="next_song">
|
||||||
|
<img id="next_pic" src="://" alt="kuk">
|
||||||
|
<div id="next_title">Coolest song</div>
|
||||||
|
</div>
|
||||||
<img id="zoff-logo" class="center" src="squareicon_small.png" alt="logo">
|
<img id="zoff-logo" class="center" src="squareicon_small.png" alt="logo">
|
||||||
<div id="player" class="hide"></div>
|
<div id="player" class="hide"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ customMessageBus.onMessage = function(event) {
|
|||||||
break;
|
break;
|
||||||
case "nextVideo":
|
case "nextVideo":
|
||||||
nextVideo = event.data.videoId;
|
nextVideo = event.data.videoId;
|
||||||
|
nextTitle = event.data.title;
|
||||||
|
$("#next_title").html(nextTitle);
|
||||||
|
$("#next_pic").attr("src", "//img.youtube.com/vi/"+nextVideo+"/mqdefault.jpg");
|
||||||
|
$("#next_song").css("display", "block");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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
6
static/dist/main.min.js
vendored
6
static/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -9,18 +9,33 @@ var List = {
|
|||||||
{
|
{
|
||||||
case "list":
|
case "list":
|
||||||
List.populate_list(msg.playlist);
|
List.populate_list(msg.playlist);
|
||||||
|
if(chromecastAvailable){
|
||||||
|
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "added":
|
case "added":
|
||||||
List.added_song(msg.value);
|
List.added_song(msg.value);
|
||||||
|
if(chromecastAvailable){
|
||||||
|
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "deleted":
|
case "deleted":
|
||||||
List.deleted_song(msg.value);
|
List.deleted_song(msg.value);
|
||||||
|
if(chromecastAvailable){
|
||||||
|
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "vote":
|
case "vote":
|
||||||
List.voted_song(msg.value, msg.time);
|
List.voted_song(msg.value, msg.time);
|
||||||
|
if(chromecastAvailable){
|
||||||
|
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "song_change":
|
case "song_change":
|
||||||
if(window.location.pathname != "/") List.song_change(msg.time);
|
if(window.location.pathname != "/") List.song_change(msg.time);
|
||||||
|
if(chromecastAvailable){
|
||||||
|
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -267,8 +282,7 @@ var List = {
|
|||||||
if($("#wrapper").children().length >= List.page + 20){
|
if($("#wrapper").children().length >= List.page + 20){
|
||||||
$($("#wrapper").children()[List.page + 20]).css("display", "block");
|
$($("#wrapper").children()[List.page + 20]).css("display", "block");
|
||||||
}
|
}
|
||||||
document.getElementById('wrapper').scrollTop += 1;
|
|
||||||
document.getElementById('wrapper').scrollTop += -1;
|
|
||||||
}catch(e){}
|
}catch(e){}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -194,6 +194,12 @@ var Player = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sendNext: function(obj){
|
||||||
|
if(chromecastAvailable){
|
||||||
|
castSession.sendMessage("urn:x-cast:zoff.no", {type: "nextVideo", title: obj.title, videoId: obj.videoId});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getTitle: function(titt, v)
|
getTitle: function(titt, v)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user