Videojs Preroll Blocking Playlist

134 Views Asked by At

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,
        });
0

There are 0 best solutions below