Open sunilitgd opened 1 month ago
Hi, I am facing issue of videoJS contrib ads plugin initializations issue and every time I am facing the same issue. Please find below my approaches -
const pobj = { autoplayAllowed: true, autoplayRequiresMute: false };
const liveTVEmbed = function() { this.initPlayer = function() { const player = videojs('liveTVPlayer', { autoplay: pobj.autoplayAllowed, muted: pobj.autoplayRequiresMute, controls: true, preload: 'auto', fluid: true, sources: [{ src: 'https://path-to-your-hls-live-tv-url.m3u8', type: 'application/x-mpegURL' }] });
// Initialize contrib-ads plugin immediately (This is not working)
player.ads();
// Add pre-roll ad configuration
player.ima({
id: 'liveTVPlayer',
adTagUrl: 'https://path-to-your-preroll-ad-tag-url'
});
player.qualityMenu();
// Add overlay plugin if needed
player.overlay({
overlays: [{
content: 'Live TV',
start: 'playing',
end: 'pause',
align: 'top-left'
}]
});
// Add event listeners if needed
player.on('ready', function() {
console.log('Player is ready');
});
player.on('error', function() {
console.error('Error occurred:', player.error());
});
}; };
VIDEOJS: ERROR: videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html Please advise the proper videojs code which can help me launching new video player.
Welcome to videojs-contrib-ads and thank you for contributing to the project! Below is a template for filing issues that will help us diagnose problems and recommend solutions.
Description
Include a short description of the problem you are seeing here.
Steps to Reproduce
Include step-by-step instructions on how to reproduce the issue:
Expected Results
Describe the behavior you expected here.
Actual Results
Describe the behavior you observed here.
Reproducing Unit Test
Please include a unit test that fails in the most recent version of videojs-contrib-ads but should pass according to your expected results. This will help us understand what the root cause is and separate ad plugin bugs from issues with this project. A unit test can be provided like below:
This example was pulled from test/states/test.Midroll.js.
Versions
videojs-contrib-ads version: the version of this plugin that you are using.
Video-js version: the version of videojs you are using. If you are using npm, you can check this by running
npm ls video.js --depth=0
in your project.Other plugins: please list other plugins that may affect videojs-contrib-ads behavior, especially ad plugins.
Platforms
Browsers: eg. Chrome v56
OS/Devices: eg. Windows 10