I want to play a small 10 minutes video in my video player. I have to use XMLHttpRequest to download the video file and then play it on my video player. I'm using Xampp
and using my PC's ip address to load the video file. But I'm getting an error and I don't know how to fix it. My code and the error is below. Please Help Me.
My HTML5 Code:
<html>
<head>
<meta charset="utf-8"/>
<title></title>
</head>
<body>
<video video-player width="640" height="360" controls></video>
<script>
var video_player = document.querySelectorAll('[video-player]')[0];
var url = "http://[my-ip-address]/video_player/media/ba/video/2d/60fps/2160p/video.mp4";
request_xhr (url, function (buffer)
{
video_player.src = buffer;
});
function request_xhr (url, cb)
{
var xhr = new XMLHttpRequest;
xhr.open('get', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function ()
{
cb(xhr.response);
};
xhr.send();
}
</script>
</body>
</html>
The error I'm getting: