I’m trying to play a live stream using Video.js in a Vue.js application, but I’m encountering the following error:
VIDEOJS: 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.
Here’s the code I’m using:
<template>
<video ref="videoPlayer" id="videoPlayer" class="video-js"></video>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import videojs from 'video.js';
import 'video.js/dist/video-js.css';
const videoPlayer = ref(null);
let player = null;
onMounted(async () => {
player = videojs(videoPlayer.value, {
autoplay: true,
controls: true,
sources: [
{
src: 'http://82.212.74.2:8000/live/7407',
type: 'application/x-mpegURL',
},
],
});
});
</script>
The stream URL (http://82.212.74.2:8000/live/7407) works perfectly in VLC Player, and VLC shows that the stream is H264 - MPEG-4 AVC.
How can I solve this issue I would really appreciate the help..