-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I've implemented the Clappr-IMA-Plugin identically as shown in the sample page.
I'm using latest versions, and a real ad network with VAST for pre-roll video ads, and everything works fine on Windows (desktop) and Android (various browsers). However, on iPhone (Safari and Chrome), the pre-roll video ads play correctly, but after the ad finishes, the player displays an error:
"Error code: hls: 4"
It seems like it fails to load the livestream video after the ad. If I disable ClapprImaPlugin, the livestream works fine on iPhone.
Additional Notes:
1 - The video is a livestream.
2 - The video requires authentication cookies to be sent with every HTTP media request. I suspect that after the pre-roll ads (sometimes with skip), the plugin might not be sending the cookies, or the player is failing to resume playback. I also tried forcing playback programmatically, but it didn't work.
3 - I tested various flag configurations without success. Sometimes it seemed to work if I manually switched to fullscreen after the ad or click play again, but not consistently.
Any tips @kslimani? Anyone? Thanks.
Here's the JavaScript code I'm using:
` <script>
let player1 = null;
function ConfigurePlayerCore(cfg) {
var plugins = [];
var config = {
parentId: '#' + cfg.playerElName,
source: cfg.playerBaseUrl + cfg.mediaRelUrl,
disableKeyboardShortcuts: true,
disableVideoTagContextMenu: true,
autoSeekFromUrl: false,
width: '100%',
height: '100%',
autoPlay: false, //autoPlay: !Clappr.Browser.isMobile,
playback: {
playInline: true, //true? -> Required by skippable ads on iOS(not fullscreen)?
recycleVideo: Clappr.Browser.isMobile,
crossOrigin: 'use-credentials', // allow sent cookies for authorization
hlsjsConfig: {
xhrSetup: function (xhr, url) {
xhr.withCredentials = true;
}
},
},
plugins: plugins,
poster: cfg.playerBaseUrl + cfg.livePhotoRelUrl + '?t=' + String(new Date().getTime()),
watermark: 'https://mydomain1.com//logo.png',
position: 'top-left',
watermarkLink: 'https://mydomain1.com/'
};
if (cfg.imaAdPlayerPluginEnabled) {
plugins.push(ClapprImaPlugin);
config.imaPlugin = {
requestAdIfNoAutoplay: true,
//disableNonLinearForIOS: true,
resetAdOnEnded: true,
imaAdPlayer: {
tag: cfg.imaAdPlayerTag,
vpaidMode: ClapprImaPlugin.vpaidMode.INSECURE,
maxDuration: 20000,
adsRenderingOptions: {
useStyledLinearAds: true,
useStyledNonLinearAds: true,
//loadVideoTimeout: 5000,
},
debug: true,
}
};
}
var player = new window.Clappr.Player(config);
var posterPlugin = player.core.mediaControl.container.getPlugin('poster');
player.on(Clappr.Events.PLAYER_STOP, function updatePoster() {
posterPlugin.options.poster = cfg.playerBaseUrl + cfg.livePhotoRelUrl + '?t=' + String(new Date().getTime());
posterPlugin.render();
});
return player;
}
function ConfigurePlayerCam1() {
let cfgCam1 = {
camId: '1',
playerElName: 'playercam1',
playerBaseUrl: 'https://mydomain1.com/',
mediaRelUrl: 'mem/abcd.m3u8',
livePhotoRelUrl: 'mem/abcd.jpg',
imaAdPlayerPluginEnabled: true,
imaAdPlayerTag: 'https://mydomain1.com/ads/vmap1.xml',
};
$("#divLoadingCam1").hide();
player1 = ConfigurePlayerCore(cfgCam1);
}
let scriptsCount = 0;
function scriptloaded_clappr() {
if (++scriptsCount == 2) {
ConfigurePlayerCam1();
}
}
</script>
<script src='https://cdn.jsdelivr.net/npm/@clappr/[email protected]/dist/clappr.min.js'
onload='scriptloaded_clappr()'
integrity='sha256-1vZmmm/d3tXYzlBdhc476hzEtS6EuVej+l2wLn2tH/w=' crossorigin='anonymous' defer></script>
<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/clappr-ima-plugin.min.js'
onload='scriptloaded_clappr()'
integrity='sha256-ZxahcyFPLd9O22SGbV8AaQkt8B5QKrWFRtGaAsTQY1I=' crossorigin='anonymous' defer></script>`