Puede implementar su propio generador de oportunidades ampliando la interfaz de OpportunityGenerator.
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);
},
…
};
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;
},
…
};
Registre la fábrica de contenido personalizado para el flujo de medios que se va a reproducir.
En el reproductor del marco de interfaz de usuario, 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'
}
}
});