hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Could not play m3u8 link from script

Open andynhuttran opened this issue 6 years ago • 4 comments

I have a m3u8 link:

http://freee.hdviet.com/17d6c8edb6b0c15502b2cde80b4043eb/s9/082020/04/Alive_2020_720p_HDRip_H/Alive_2020_720p_HDRip_H_640/playlist.m3u8

The link could be played in VCL and in Chrome directly after installing plugin "Native HLS Playback" However, I could not play it from my web page from "Getting Started" guide.

Here my code in HTML file:

`

	<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
	<video id="video" controls></video>
	<script>
		var video = document.getElementById('video');
		var videoSrc = "http://freee.hdviet.com/17d6c8edb6b0c15502b2cde80b4043eb/s9/082020/04/Alive_2020_720p_HDRip_H/Alive_2020_720p_HDRip_H_640/playlist.m3u8";
	
		if (Hls.isSupported()) {
			var hls = new Hls({
				debug: true
			});
			hls.loadSource(videoSrc);
			hls.attachMedia(video);
			hls.on(Hls.Events.MANIFEST_PARSED, function() {
				video.play();				
			});
			
			hls.on(Hls.Events.ERROR, function (event, data) {
				alert("event: " + event);
			});
			
		}
	  </script>

`

Besides that, the u3m8 link can not be played in the Demo link https://hls-js.netlify.com/demo as well. I don't know why. Could someone help me in this case? thank you so much.

andynhuttran avatar Aug 15 '20 15:08 andynhuttran

You are missing CORS headers on the requested asset. If you have access to the streaming server add CORS headers in the response.

OrenMe avatar Aug 16 '20 05:08 OrenMe

You are missing CORS headers on the requested asset.

How to do that when I am using hls.js?.

This is my console error from chrome from origin 'null' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains the invalid value '403'.

If you have access to the streaming server add CORS headers in the response.

I have no access to the streaming server.

Thanks for your help

andynhuttran avatar Aug 18 '20 17:08 andynhuttran

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Sep 11 '20 02:09 stale[bot]

This issue has been automatically closed because it has not had recent activity. If this issue is still valid, please ping a maintainer and ask them to label it accordingly.

stale[bot] avatar Sep 14 '20 03:09 stale[bot]