This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyMediaSessionCallback: MediaSessionCompat.Callback { | |
| override fun onPause() { ... } | |
| override fun onPlay() { ... } | |
| override fun onStop() { ... } | |
| override fun onSeekTo(position: Long) { ... } | |
| override fun onSkipToNext() { ... } | |
| override fun onSkipToPrevious() { ... }} | |
| mediaSession.setCallback(myMediaSessionCallback) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val program = WatchNextProgram.Builder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .setWatchNextType( | |
| WatchNextPrograms.WATCH_NEXT_TYPE_CONTINUE) | |
| .setContentId(myProgramId) | |
| .setType(PreviewPrograms.TYPE_MOVIE) | |
| .setTitle("Program Title") | |
| .setDescription("Program Description") | |
| .setPosterArtUri( | |
| Uri.parse("http://example.com/poster_art.png")) | |
| .setLastEngagementTimeUtcMillis(System.currentTimeMillis()) | |
| Then you build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PreviewChannelHelper(context).publishWatchNextProgram(program) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val previewChannel = PreviewChannel.Builder() | |
| .setDisplayName(name) | |
| .setDescription(description) | |
| .setAppLinkIntentUri(Uri.parse(deeplinkUri)) | |
| .setInternalProviderId(getPlaylistId()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .setLogo(bitmap) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .build() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val helper = PreviewChannelHelper(context) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val channelId = helper.publishChannel(previewChannel) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val program = PreviewProgram.Builder() | |
| .setChannelId(channelId) | |
| // Matches the intent filter in the manifest for VIEW action | |
| .setIntentUri(Uri.parse("https://.../program/$id")) | |
| .build() | |
| helper.publishPreviewProgram(program) |