mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
More updates receiver
This commit is contained in:
@@ -1,3 +1,48 @@
|
||||
cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);
|
||||
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
|
||||
/**
|
||||
* Application config
|
||||
**/
|
||||
var appConfig = new cast.receiver.CastReceiverManager.Config();
|
||||
|
||||
/**
|
||||
* Text that represents the application status. It should meet
|
||||
* internationalization rules as may be displayed by the sender application.
|
||||
* @type {string|undefined}
|
||||
**/
|
||||
appConfig.statusText = 'Ready to play';
|
||||
|
||||
/**
|
||||
* Maximum time in seconds before closing an idle
|
||||
* sender connection. Setting this value enables a heartbeat message to keep
|
||||
* the connection alive. Used to detect unresponsive senders faster than
|
||||
* typical TCP timeouts. The minimum value is 5 seconds, there is no upper
|
||||
* bound enforced but practically it's minutes before platform TCP timeouts
|
||||
* come into play. Default value is 10 seconds.
|
||||
* @type {number|undefined}
|
||||
**/
|
||||
// 100 minutes for testing, use default 10sec in prod by not setting this value
|
||||
appConfig.maxInactivity = 6000;
|
||||
/**
|
||||
* Initializes the system manager. The application should call this method when
|
||||
* it is ready to start receiving messages, typically after registering
|
||||
* to listen for the events it is interested on.
|
||||
*/
|
||||
window.castReceiverManager.start(appConfig);
|
||||
|
||||
window.castReceiverManager.onSenderDisconnected = function(event) {
|
||||
if(window.castReceiverManager.getSenders().length == 0 &&
|
||||
event.reason == cast.receiver.system.DisconnectReason.REQUESTED_BY_SENDER) {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
var customMessageBus = castReceiverManager.getCastMessageBus('urn:x-cast:super.awesome.example');
|
||||
customMessageBus.onMessage = function(event) {
|
||||
console.log(event);
|
||||
}
|
||||
|
||||
/*
|
||||
var receiver = new cast.receiver.Receiver("E6856E24", ["no.zoff.customcast"],"",5);
|
||||
var ytChannelHandler = new cast.receiver.ChannelHandler("no.zoff.customcast");
|
||||
var nextVideo;
|
||||
@@ -63,7 +108,7 @@ function onPlayerStateChange(event) {
|
||||
channel.send({'event':'stateChange','message':event.data});
|
||||
/*if (event.data==YT.PlayerState.ENDED) {
|
||||
endcast();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
@@ -72,4 +117,4 @@ function onPlayerStateChange(event) {
|
||||
|
||||
function endcast() {
|
||||
setTimeout(window.close, 2000);
|
||||
}
|
||||
}*/
|
||||
|
||||
Reference in New Issue
Block a user