Skip to content

Instantly share code, notes, and snippets.

@vizbee
vizbee / VizbeeChromecastCAF_AddVizbeeChannelWithDefaultOptions.js
Last active October 29, 2020 00:51
Add Vizbee custom channel to CastReceiverContext start API with default CastReceiverOptions
// add Vizbee customNamespace in CastReceiverOptions for CastReceiverContext start
let context = cast.framework.CastReceiverContext.getInstance();
context.start({
supportedCommands: cast.framework.messages.Command.ALL_BASIC_MEDIA
customNamespaces: {
'urn:x-cast:tv.vizbee.sync': cast.framework.system.MessageType.STRING
}
});
@vizbee
vizbee / VizbeeChromecastCAF_NoLoadRequestInterceptor.js
Last active October 29, 2020 00:54
Vizbee LoadRequestInterceptor is not added since host receiver doesn't need any customData from Vizbee
// intercept the LOAD request to be able to read in a contentId and get data
playerManager.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, loadRequestData => {
// host app performs updates to loadRequestData as needed ...
return loadRequestData;
});
@vizbee
vizbee / VizbeeChromecastCAF_Initialization.js
Last active October 29, 2020 01:15
Add and Initialise Vizbee Chromecast CAF SDK
// add Vizbee Chromecast CAF SDK library in entry (receiver.html) file of your receiver
<script src="https://static.claspws.tv/sdk/receivers/chromecast/v6/vizbee.js"></script>
// initialize the Vizbee SDK before CastReceiverContext.start in your receiver and
// replace the vzbxxxxxxx with Vizbee appID assigned for your app
let vzbContext = vizbee.framework.ContinuityContext.getInstance();
vzbContext.start('vzbxxxxxxx');
@vizbee
vizbee / VizbeeChromecastCAF_AddVizbeeNamespaceWithCustomOptions.js
Last active October 29, 2020 01:15
Add Vizbee custom channel to CastReceiverContext start API with customized CastReceiverOptions (ie., Queue & PlaybackConfig)
// optional: Import your own CastQueue if any for playlist implementation
import { CastQueue } from './queuing.js';
// optional: Set the player to start playback as soon as there are five seconds of
// media content buffered. Default is 10.
const playbackConfig = new cast.framework.PlaybackConfig();
playbackConfig.autoResumeDuration = 5;
// add Vizbee custom namespace in CastReceiverOptions for CastReceiverContext start
let context = cast.framework.CastReceiverContext.getInstance();
@vizbee
vizbee / VizbeeChromecastCAF_LoadRequestInterceptor.js
Last active October 29, 2020 01:21
Vizbee LoadRequestInterceptor is added since host receiver needs customData from Vizbee
// create Vizbee LoadRequestInterceptor to intercept and convert loadRequestData sent by Vizbee sdk
let vzbLoadRequestInterceptor = new vizbee.framework.LoadRequestInterceptor((vzbLoadRequestData) => {
// update vzbLoadRequestData to loadRequestData format expected by your receiver
let updatedLoadRequestData = vzbLoadRequestData;
updatedLoadRequestData.media.contentId = vzbLoadRequestData.media.customData.guid;
return updatedLoadRequestData;
});
// intercept the LOAD request to be able to read in a contentId and get data

Snippets for Vizbee Android Sender SDK

Instructions

  • Look up the use case or scenario related to Vizbee SDK integration in the list below.
  • The corresponding snippet provides template code to address the scenario.
  • Copy the template code and update based on your app's requirements.

Integration scenarios & snippets

Analytics

Scenario

Show Vizbee overlay UI cards like SmartInstall card and CastIntroduction card as middle overlays with rounded call-to-action buttons.

overlay with filled button

overlay with filled button

Style configuration

    @"classes" : @{                                               
            @"OverlayCallToActionButton" : @{                                                    
@vizbee
vizbee / VizbeeChromecastCAFSnippets.md
Last active November 9, 2020 23:02
Snippets for Vizbee Chromecast CAF SDK

Snippets for Vizbee Chromecast CAF SDK

Instructions

  • Look up the use case or scenario related to Vizbee SDK integration in the list below.
  • The corresponding snippet provides template code to address the scenario.
  • Copy the template code and update based on your app's requirements.

Scenarios & Snippets

Initialization

public class MyFireTVApplication extends Application {
public onCreate() {
super.onCreate();
// initialize Vizbee SDK
VizbeeWrapper.getInstance().initialize(this);
}
}
class MyFireTVApplication : Application() {
override fun onCreate() {
super.onCreate()
// initialize Vizbee SDK
VizbeeWrapper.getInstance().initialize(this)
}