7. • Sender application
Two components
Applications running on a mobile device or laptop
• Receiver application
(HTML, JavaScript , CSS) app running on a Chromecast or other
cast compatible device.
8. • Sender application
Two components
Applications running on a mobile device or laptop
• Receiver application
(HTML, JavaScript , CSS) app running on a Chromecast or other
cast compatible device.
12. • Custom Media Receiver
3 Types of receivers
Requires application id , DRM Content, Data centric apps
• Styled Media Receiver
Can be styled with CSS files, requires application id
• Default Media Receiver
Does not require application id, can use
CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID in your sender if using CCL
16. <script>
//[3] handle the payload from the sender
function process(json){
console.log('received: ' + json.url);
document.getElementById("image").src= json.url;
}
//[1] get a handle to the receiver manager
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
castReceiverManager.onSenderDisconnected = function(event) {
console.log('disconnected: ' + event.data);
if (window.castReceiverManager.getSenders().length == 0) { //close the app if we have no more connected devices
window.close();
}
};
//[2] create a CastMessageBus to handle messages for a custom namespace
window.messageBus = window.castReceiverManager.getCastMessageBus('urn:x-cast:com.peirr.localcast');
window.messageBus.onMessage = function(event) {
var json = JSON.parse(event['data']); //decode the request from sender app
window.sender = event.senderId;
process(json);
}
//[4]start the listener
window.castReceiverManager.start();
</script>
18. • Development
• Publish to any server & add endpoint to cast
console
• Debug http://RECEIVER-IP-ADDRESS:9222
• Production
Server has to be secure (https://<yourserver>)
• Google Cast SDK Developer Console
https://cast.google.com/publish/
Publishing
19. • Development
• Publish to any server & add endpoint to cast
console
• Debug http://RECEIVER-IP-ADDRESS:9222
• Production
Server has to be secure (https://<yourserver>)
• Google Cast SDK Developer Console
https://cast.google.com/publish/
Publishing
20. • Development
• Publish to any server & add endpoint to cast
console
• Debug http://RECEIVER-IP-ADDRESS:9222
• Production
Server has to be secure (https://<yourserver>)
• Google Cast SDK Developer Console
https://cast.google.com/publish/
Publishing