Implementare un generatore di opportunità personalizzato

Puoi implementare un generatore di opportunità personalizzato estendendo l’interfaccia OpportunityGenerator.

  1. Crea il generatore di opportunità personalizzato.

    Ad esempio:

    /**
    * Class implementing AdobePSDK.OpportunityGenerator interface
    */
    CustomOpportunityGenerator = function () {
    };
    
    CustomOpportunityGenerator.prototype = {
        constructor: CustomOpportunityGenerator,
        configureCallbackFunc: function (item, client, mode, playhead, playbackRange) {
            // the playhead represents the initial playback position
            // the playback range represents the initial playback range
    
            // the item property indicates the current AdobePSDK.MediaPlayerItem associated with this generator
            // the initial set of timed metadata can be obtain through the item property
            var timedMetadatas = item.timedMetadata;
        },
        updateCallbackFunc: function (playhead, playbackRange) {
            // when an opportunity is created by this generator
            // we need to notify the TVSDK through the client property
            client.resolve (opportunity);
        },
        …
    };
    
  2. Crea il factory dei contenuti personalizzato, che utilizza il generatore di opportunità personalizzato.

    Ad esempio:

    /**
      * Class implementing AdobePSDK.ContentFactory interface
    */
    CustomContentFactory = function () {
    };
    
    CustomContentFactory.prototype = {
           constructor: CustomContentFactory,
           retrieveOpportunityGeneratorsCallbackFunc: function (item) {
                var result = [];
                result.push (new CustomOpportunityGenerator());
                return result;
        },
        …
    };
    
  3. Registra il factory dei contenuti personalizzati per il flusso multimediale da riprodurre.

    In UI Framework player (Lettore framework interfaccia utente), puoi specificare il content factory personalizzato come segue:

    var advertisingFactory = new CustomContentFactory();
    var playerWrapper = ptp.videoPlayer('.videoDiv', {
     player: {
            mediaPlayerItemConfig: {
                    advertisingFactory: advertisingFactory
            },
                mediaResource: {
                    resourceUrl:'Specify Resource Url'
           }
      }
    });
    

In questa pagina