The Share plugin provides JavaScript API for triggering the shared link generation and retrieval as well as invoking the share operation itself:
"doShare" Notification: is used to trigger the shared link generation. You can specify the required time offset by sending a configuration object, for example: { "timeOffset" : "30" }
"shareEvent" Event: is triggered by the plugin once the shared link is generated. It provides access to the generated shared link by accessing the event's "sharedLink" property.
"shareByPlatform" Notification: is used to invoke the share operation without displaying the Share UI on top of the player. The required network is send as a parameter.
Trigger Share event:
- kWidget.addReadyCallback(function( playerId ){
- var kdp = $('#' + playerId)[0];
- kdp.kBind( 'shareEvent', function(event){
- // retrieve the share link
- var shareLink = event.shareLink;
- });
- // trigger share event
- kdp.sendNotification( 'doShare' );
- // trigger share event with time offset
- kdp.sendNotification( 'doShare', { "timeOffset" : "30" } );
- // trigger shareByPlatform event
- kdp.sendNotification( 'shareByPlatform', 'facebook' );
- });
Trigger Share for Platform: