mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-01-11 12:05:34 +00:00
Compare commits
6 Commits
feat/added
...
feature/ch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1edb69170b | ||
|
|
8d40748a81 | ||
|
|
4270ce8027 | ||
|
|
183f2ae5b9 | ||
|
|
d24c542f2a | ||
|
|
3ab65acd9e |
@@ -5,11 +5,11 @@ var gulp = require('gulp'),
|
||||
|
||||
gulp.task('js', function () {
|
||||
gulp.src(['server/VERSION.js', 'server/config/api_key.js', 'server/public/assets/js/*.js', '!server/public/assets/js/embed*', '!server/public/assets/js/remotecontroller.js', '!server/public/assets/js/callback.js'])
|
||||
.pipe(uglify({
|
||||
/*.pipe(uglify({
|
||||
mangle: true,
|
||||
compress: true,
|
||||
enclose: true
|
||||
}))
|
||||
}))*/
|
||||
.pipe(concat('main.min.js'))
|
||||
.pipe(gulp.dest('server/public/assets/dist'));
|
||||
});
|
||||
|
||||
@@ -105,7 +105,15 @@ function hide_native(way) {
|
||||
}
|
||||
|
||||
function chromecastListener(evt, data) {
|
||||
console.log(evt, data);
|
||||
var json_parsed = JSON.parse(data);
|
||||
try {
|
||||
json_parsed = JSON.parse(json_parsed);
|
||||
} catch(e) {
|
||||
console.log("error parsing again");
|
||||
}
|
||||
console.log(json_parsed.type, typeof(json_parsed));
|
||||
//console.log(JSON.parse(json_parsed), json_parsed.type, json_parsed.type == 1, json_parsed.type == "1");
|
||||
switch(json_parsed.type){
|
||||
case -1:
|
||||
if(offline){
|
||||
|
||||
@@ -141,7 +141,9 @@ window.zoff = {
|
||||
if(!Helper.mobilecheck()) {
|
||||
$(window).error(function(e){
|
||||
e.preventDefault();
|
||||
Helper.logs.unshift({log: e.originalEvent.error.stack.toString().replace(/(\r\n|\n|\r)/gm,""), date: new Date()});
|
||||
try {
|
||||
Helper.logs.unshift({log: e.originalEvent.error.stack.toString().replace(/(\r\n|\n|\r)/gm,""), date: new Date()});
|
||||
}catch(e){}
|
||||
$(".contact-form-content").remove();
|
||||
$("#submit-contact-form").remove();
|
||||
$(".contact-modal-header").text("An error occurred");
|
||||
@@ -236,6 +238,32 @@ initializeCastApi = function() {
|
||||
switch (event.sessionState) {
|
||||
case cast.framework.SessionState.SESSION_STARTED:
|
||||
castSession = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
var customData = [
|
||||
{type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title},
|
||||
{type: "loadVideo", start: Player.np.start, end: Player.np.end, videoId: video_id, seekTo: _seekTo, channel: chan.toLowerCase()},
|
||||
];
|
||||
if(Helper.mobilecheck()) {
|
||||
customData.push({type: "mobilespecs", guid: guid, socketid: socket.id, adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), channel: chan.toLowerCase(), userpass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||
}
|
||||
var metadata = new chrome.cast.media.GenericMediaMetadata();
|
||||
metadata.title = song_title
|
||||
metadata.image = 'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg';
|
||||
metadata.images = ['https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg'];
|
||||
var mediaInfo = new chrome.cast.media.MediaInfo();
|
||||
mediaInfo.contentType = "video/*";
|
||||
mediaInfo.contentId = video_id;
|
||||
mediaInfo.duration = Player.np.end - Player.np.start;
|
||||
var request = new chrome.cast.media.LoadRequest();
|
||||
request.media = mediaInfo;
|
||||
request.customData = customData;
|
||||
request.metadata = metadata;
|
||||
castSession.loadMedia(request).then(
|
||||
function() {
|
||||
console.log('Load succeed');
|
||||
},
|
||||
function(errorCode) {
|
||||
console.log('Error code: ' + errorCode);
|
||||
});
|
||||
castSession.addMessageListener("urn:x-cast:zoff.me", chromecastListener)
|
||||
chrome.cast.media.GenericMediaMetadata({metadataType: 0, title:song_title, image: 'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg', images: ['https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg']});
|
||||
//chrome.cast.Image('https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg');
|
||||
|
||||
Reference in New Issue
Block a user