I have set up nginx with the current latest version following https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/
I have connected successfully to the server and VCL was receiving a stream.
I left it for one week. When I returned I found I could not longer receive hls streams, or any streams.
I have tried many different pathways of installation but the most successful is still the one I followed above. Every new installation attempt falls at the hls stream pusshing from the server.
Output from nginx root folder:
total 12812
drwxr-xr-x 2 nobody www-data 4096 Jun 16 16:04 .
drwxr-xr-x 3 www-data www-data 4096 Jun 16 15:58 ..
-rw-r--r-- 1 nobody nogroup 837916 Jun 16 16:02 test-0.ts
-rw-r--r-- 1 nobody nogroup 835848 Jun 16 16:02 test-1.ts
-rw-r--r-- 1 nobody nogroup 1007116 Jun 16 16:04 test-10.ts
-rw-r--r-- 1 nobody nogroup 1012380 Jun 16 16:04 test-11.ts
-rw-r--r-- 1 nobody nogroup 1004860 Jun 16 16:04 test-12.ts
-rw-r--r-- 1 nobody nogroup 1013508 Jun 16 16:04 test-13.ts
-rw-r--r-- 1 nobody nogroup 242896 Jun 16 16:04 test-14.ts
-rw-r--r-- 1 nobody nogroup 850512 Jun 16 16:03 test-2.ts
-rw-r--r-- 1 nobody nogroup 826636 Jun 16 16:03 test-3.ts
-rw-r--r-- 1 nobody nogroup 849948 Jun 16 16:03 test-4.ts
-rw-r--r-- 1 nobody nogroup 830208 Jun 16 16:03 test-5.ts
-rw-r--r-- 1 nobody nogroup 837540 Jun 16 16:03 test-6.ts
-rw-r--r-- 1 nobody nogroup 902588 Jun 16 16:03 test-7.ts
-rw-r--r-- 1 nobody nogroup 1011440 Jun 16 16:03 test-8.ts
-rw-r--r-- 1 nobody nogroup 1012756 Jun 16 16:04 test-9.ts
-rw-r--r-- 1 nobody nogroup 448 Jun 16 16:04 test.m3u8
So there is a stream being produced.
JW Player supplies error code 232011 - Cannot load M3U8: Crossdomain access denied
nginx conf:
worker_processes auto;
events {
worker_connections 1024;
}
# RTMP configuration
rtmp {
server {
listen 1935; # Listen on standard RTMP port
chunk_size 4000;
application show {
live on;
# Turn on HLS
hls on;
hls_path /nginx/hls/;
hls_fragment 3;
hls_playlist_length 60;
# disable consuming the stream from nginx as rtmp
deny play all;
}
}
}
http {
sendfile off;
tcp_nopush on;
# aio on;
directio 512;
default_type application/octet-stream;
server {
listen 8080;
location / {
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/dash+xml mpd;
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /nginx/;
}
}
}
Can anyone assist in identifying the error please?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
The error message “Cannot load M3U8: Crossdomain access denied” is a common issue with JW Player when it’s not served from the same domain as the web page and is restricted due to the same-origin policy.
However, you already have CORS headers setup in your nginx configuration. Your configuration seems fine and should theoretically allow cross-origin requests.
But it looks like JW Player isn’t able to access the M3U8 file due to a cross-domain issue. A couple of things you could try:
Make sure your CORS setup is correct and is being applied: The CORS headers must be returned in the response from the server for the JW Player to be able to play the content. Check the response headers of your M3U8 file by using the developer tools in your browser or using a tool like curl -I to see the response headers. If the CORS headers aren’t there, your nginx configuration might not be applied correctly.
Check if your content is served over HTTPS while your page is on HTTP or vice versa: JW Player requires the page and the content to be served over the same protocol (both HTTP or both HTTPS). Make sure this is not the issue.
Crossdomain.xml: Even though CORS is the modern way to handle cross-origin requests, Flash players might still need a crossdomain.xml file served from the root of the server. You might need to add this if your JW Player falls back to Flash player for some reason.
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.