I am work on autoplay video playlist. I use glob to get all video absolute path from a target folder. My code is below:
let vm = this;
let trailerList = null;
trailerList = glob.sync(`${__static}/trailers/*.{mp4,flv,mov}`).map(path => {
return {
sources: [{ src: path }]
};
});
let option = {
autoplay: true,
controls: false,
muted: true
};
this.player = videojs(this.$refs.videoPlayer, option, () => {
this.player.playlist(trailerList);
this.player.playlist.autoadvance(0);
this.player.playlist.repeat(true);
});
I got a ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported
. It work if replace the variable path
to require("C:/.../static/trailers/Video.mp4")
. However, replace as require(path)
will return module not found