Implementar un generador de oportunidades personalizado

Puede implementar su propio generador de oportunidades ampliando la interfaz de OportunityGenerator.

  1. Cree el generador de oportunidades personalizado.

    Por ejemplo:

    /** 
    * 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. Cree la fábrica de contenido personalizado, que utiliza el generador de oportunidades personalizado.

    Por ejemplo:

    /** 
      * Class implementing AdobePSDK.ContentFactory interface 
    */ 
    CustomContentFactory = function () { 
    }; 
    
    CustomContentFactory.prototype = { 
           constructor: CustomContentFactory, 
           retrieveOpportunityGeneratorsCallbackFunc: function (item) { 
                var result = []; 
                result.push (new CustomOpportunityGenerator()); 
                return result; 
        }, 
        … 
    }; 
    
  3. Registre la fábrica de contenido personalizado para la reproducción del flujo de medios.

    En el reproductor de UI Framework, puede especificar la fábrica de contenido personalizado de la siguiente manera:

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

En esta página

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now