Skip to content

Instantly share code, notes, and snippets.

@tifroz
Created December 9, 2017 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tifroz/04d067e0bfa53827fdd48959c51bb573 to your computer and use it in GitHub Desktop.
Save tifroz/04d067e0bfa53827fdd48959c51bb573 to your computer and use it in GitHub Desktop.
Google Cast: CAF receiver test for plain mp4 file
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js">
</script>
</head>
<body>
<cast-media-player></cast-media-player>
<script>
var context = cast.framework.CastReceiverContext.getInstance()
var playerManager = context.getPlayerManager() ;
context.start() ;
// Build the LoadRequestData object
var qi = new cast.framework.messages.QueueItem() ;
var media = new cast.framework.messages.MediaInformation() ;
// The media is file-based (mp4), no captions, it should not be loaded with xmlHttpRequest
media.contentId = "http://s3.amazonaws.com/web.swishly.com/webtv/test/Sample-Movie.mp4" ;
qi.media = media ;
var qd = new cast.framework.messages.QueueData(null, null, null, null, [qi], 0, 0) ;
var lrd = new cast.framework.messages.LoadRequestData() ;
lrd.queueData = qd ;
// Using a plain mp4, no captions/subtitles, this *should* just play
playerManager.load(lrd)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment