0

I want to add ads to my videos using Videojs preroll. I added it and it works just fine. But I want to run the videojs playlist plugin and they are blocking each other. When the video ends, it does not go to the next video. If I don't use videojs preroll, the videojs playlist plugin works. Can you help me ?. You can review my code.

var player = videojs("examplePlayer", {
            playbackRates: [0.25, 0.5, 1, 1.5, 2, 2.5],
            controls: true,
            loop: false,
        });
        player.playlist([
            {
                sources: [
                    {
                        src: "http://media.w3.org/2010/05/sintel/trailer.mp4",
                        type: "video/mp4",
                    },
                ],
                poster: "http://media.w3.org/2010/05/sintel/poster.png",
            },
            {
                sources: [
                    {
                        src: "http://media.w3.org/2010/05/bunny/trailer.mp4",
                        type: "video/mp4",
                    },
                ],
                poster: "http://media.w3.org/2010/05/bunny/poster.png",
            },
            {
                sources: [
                    {
                        src: "http://vjs.zencdn.net/v/oceans.mp4",
                        type: "video/mp4",
                    },
                ],
                poster: "http://www.videojs.com/img/poster.jpg",
            },
            {
                sources: [
                    {
                        src: "http://media.w3.org/2010/05/bunny/movie.mp4",
                        type: "video/mp4",
                    },
                ],
                poster: "http://media.w3.org/2010/05/bunny/poster.png",
            },
            {
                sources: [
                    {
                        src: "http://media.w3.org/2010/05/video/movie_300.mp4",
                        type: "video/mp4",
                    },
                ],
                poster: "http://media.w3.org/2010/05/video/poster.png",
            },
        ]);

        // Play through the playlist automatically.
        player.playlist.autoadvance(0);
        // fire up the plugin
        player.preroll({
            src: {
                src: "./reklam.mp4",
                type: "video/mp4",
            },
            href: "http://videojs.com",
            adsOptions: { debug: true },
            skipTime: 5,
            adSign: true,
        });
Hiedrass
  • 75
  • 6
  • 1
    There's more than one plugin called "preroll" in the wild, but I see this one has specific instrucitons for when using the playlist plugin, so ought to be compatible: https://www.npmjs.com/package/videojs-preroll-v2 – misterben Sep 09 '22 at 09:38
  • @misterben It just lets us get the ads into a playlist. Also, this plugin does not work correctly. – Hiedrass Sep 12 '22 at 11:07

0 Answers0