Access Control Preview, Custom Purchase Flow
Demo will pause at 10 seconds, and offer a purchase button.
The button calls a back end service that hands off a KS to the player.
In a production environment you would check for purchase confirmation
Integration Guide:
The default free preview dialog is repressed with disableAlerts, and an custom action is overlaid,
to demonstrate end to end preview -> purchase work flow.
Basic flow is as follows:
- kWidget.embed( 'playerTarget', {
- 'wid' : '_243342',
- 'uiconf_id' : '8145862',
- 'entry_id' : '1_20x0ca3l',
- 'flashvars':{
- 'disableAlerts': true
- },
- 'readyCallback': function( playerId ){
- kdp = $('#' + playerId)[0];
- // add a listener for onFreePreviewEnd event
- kdp.kBind( 'freePreviewEnd', function(){
- // video will be paused
- // add your purchase flow
- $('<div>').addClass('your-purchase-dialog')
- .find('#purchase-done-button').click(function(){
- // async purchase flow is complete, send the ks to the player:
- kdp.setKDPAttribute( 'servicesProxy.kalturaClient', 'ks', ksJSON.ks );
- $('.myPurchaseDialog').remove();
- // player should be in "ready to play" state.
- })
- } );
- }
- });
html5 qunit | flash qunit