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:
  1. kWidget.embed( 'playerTarget', {
  2. 'wid' : '_243342',
  3. 'uiconf_id' : '8145862',
  4. 'entry_id' : '1_20x0ca3l',
  5. 'flashvars':{
  6. 'disableAlerts': true
  7. },
  8. 'readyCallback': function( playerId ){
  9. kdp = $('#' + playerId)[0];
  10. // add a listener for onFreePreviewEnd event
  11. kdp.kBind( 'freePreviewEnd', function(){
  12. // video will be paused
  13. // add your purchase flow
  14. $('<div>').addClass('your-purchase-dialog')
  15. .find('#purchase-done-button').click(function(){
  16. // async purchase flow is complete, send the ks to the player:
  17. kdp.setKDPAttribute( 'servicesProxy.kalturaClient', 'ks', ksJSON.ks );
  18. $('.myPurchaseDialog').remove();
  19. // player should be in "ready to play" state.
  20. })
  21. } );
  22. }
  23. });
html5 qunit | flash qunit