gpac / node-gpac-dash

NodeJS module for DASH streaming using GPAC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Low-latency DASH Server with live content not working with dash.js

astroty opened this issue · comments

commented

When I try using the dash.js player together with this program, it gives me an error message and no video loads.

XMLHttpRequest cannot load http://ip:8000/output/v1_215_gpac.m4s. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://ip:1234' is therefore not allowed access. The response had HTTP status code 404.

It loads the manifest just fine (I added the Access-Control-Allow-Origin for it to work), but as soon as it starts fetching the segments, it gives me that error. Probably because it starts with the first one, which usually isn't there anymore.

This is the lowest latency solution I've found so far, but I need a way to stream it through a browser, since people won't usually have MP4client with them, or a command line.

Browser log:

R rules.
dash.all.js:3 Checking download ratio rule...
dash.all.js:3 No requests made for this stream yet, bailing.
dash.all.js:3 Checking insufficient buffer rule...
dash.all.js:3 Not enough information for rule.
dash.all.js:3 [M…r.r…s.SwitchRequest, M…r.r…s.SwitchRequest]
dash.all.js:3 New quality of 0
dash.all.js:3 video Playback quality: 0
dash.all.js:3 Populate video buffers.
dash.all.js:3 video Quality changed to: 0
dash.all.js:3 Marking a special seek for initial video playback.
dash.all.js:3 Getting the initialization request.
dash.all.js:3 Got an initialization.
dash.all.js:3 Loading video initialization: http://ipadress:8000/output/v1_init_gpac.mp4
dash.all.js:3 M…r.vo.SegmentRequest {action: "download", startTime: NaN, streamType: "video", type: "Initialization Segment", duration: NaN…}
dash.all.js:3 BufferController video setState to:LOADING
dash.all.js:3 segment loaded: (200, 0ms, 7ms, 7ms) http://ipadress:8000/output/v1_init_gpac.mp4
dash.all.js:3 video Bytes finished loading: http://ipadress:8000/output/v1_init_gpac.mp4
dash.all.js:3 Push (video) bytes: 784
dash.all.js:3 Got loadmetadata event.
dash.all.js:3 playback initialized!
dash.all.js:3 Attempting play...
dash.all.js:3 Do play.
dash.all.js:3 Got play event.
dash.all.js:3 Starting playback.
dash.all.js:3 Append video complete: 0
dash.all.js:3 BufferController video setState to:READY
dash.all.js:3 Working time is video time: 0
dash.all.js:3 BufferController.validate() video | state: READY
dash.all.js:3 video Playback rate: 0
dash.all.js:3 video Working time: 0
dash.all.js:3 video Video time: 0
dash.all.js:3 Current video buffer length: 0
dash.all.js:3 BufferController video setState to:VALIDATING
dash.all.js:3 ABR enabled? (true)
dash.all.js:3 Check ABR rules.
dash.all.js:3 Checking download ratio rule...
dash.all.js:3 Total time: 0.007s
dash.all.js:3 Download time: 0.007s
dash.all.js:3 The ratios are NaN, bailing.
dash.all.js:3 Checking insufficient buffer rule...
dash.all.js:3 Not enough information for rule.
dash.all.js:3 [M…r.r…s.SwitchRequest, M…r.r…s.SwitchRequest]
dash.all.js:3 New quality of 0
dash.all.js:3 video Playback quality: 0
dash.all.js:3 Populate video buffers.
dash.all.js:3 Quality didn't change.
dash.all.js:3 Loading the video fragment for time: 0
dash.all.js:3 Getting the request for time: 0
dash.all.js:3 Got segments.
dash.all.js:3 null
dash.all.js:3 No segments found, so we must be using a SegmentTemplate.
dash.all.js:3 Index for time 0 is 1
dash.all.js:3 Checking for stream end...
dash.all.js:3 Live never ends! (TODO)
dash.all.js:3 Stream finished? false
dash.all.js:3 Got a request.
dash.all.js:3 M…r.vo.SegmentRequest {action: "download", startTime: 1, streamType: "video", type: "Media Segment", duration: 1…}
dash.all.js:3 Loading an video fragment: http://ipadress:8000/output/v1_1_gpac.m4s
dash.all.js:3 BufferController video setState to:LOADING
dash.all.js:3 GET http://ipadress:8000/output/v1_1_gpac.m4s d @ dash.all.js:3e @ dash.all.js:3load @ dash.all.js:3X @ dash.all.js:3f @ dash.all.js:1k.promiseDispatch.j @ dash.all.js:1e.promiseDispatch @ dash.all.js:1(anonymous function) @ dash.all.js:1B.port1.onmessage @ dash.all.js:1
ipadress/:1 XMLHttpRequest cannot load http://ipadress:8000/output/v1_1_gpac.m4s. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://ipadress:1234' is therefore not allowed access. The response had HTTP status code 404.
2dash.all.js:3 segment loaded: (0, 7ms, 0ms, 7ms) http://ipadress:8000/output/v1_1_gpac.m4s
dash.all.js:3 BufferController video setState to:READY
dash.all.js:3 Working time is video time: 0
dash.all.js:3 BufferController.validate() video | state: READY
dash.all.js:3 video Playback rate: 0
dash.all.js:3 video Working time: 0
dash.all.js:3 video Video time: 0
dash.all.js:3 Current video buffer length: 0
dash.all.js:3 BufferController video setState to:VALIDATING
dash.all.js:3 ABR enabled? (true)
dash.all.js:3 Check ABR rules
....

Console log

[01:11:41.219] Server running on ipadress:8000 in low-latency mode
[01:11:55.588] Request for file: output/dashcast.mpd at UTC 1444623115587
[01:11:56.665] Request for file: output/v1_init_gpac.mp4 at UTC 1444623116665
[01:11:57.729] Request for non existing file: output/v1_1_gpac.m4s at UTC 1444623117729
[01:11:58.677] Request for non existing file: output/v1_2_gpac.m4s at UTC 1444623118677
[01:11:59.686] Request for non existing file: output/v1_3_gpac.m4s at UTC 1444623119686

...

Thanks for the feedback. The program has only been tested with MP4Client as a client. Its use would be limited with browsers as there is currently no reliable way to get chunks into a web application when the HTTP download uses chunk transfer encoding. Still, it would be good to have the server work (in normal mode) with browsers. So regarding the CORS problem, you can try patching the code to add the headers with each request, or only segment requests. We'd be happy to integrate a pull request.

I might take a crack at this. I think the value add for browsers-as-clients speaks for itself.

FYI, I've just merged a PR from @nickdesaulniers which adds CORS to the server. This should work better with DASH.js then. Can you try and let us know?

Also, besides dash.js, another high-quality web-based FOSS DASH client library is shaka player.

Make sure you start the server with the -cors flag. It just whitelists every domain. If you want to be more restrictive, patch the code or send a PR.

I gave this shot with the dash.js player and it's still not quite working, seeing MEDIA_ERR_DECODE in the console.

What parameters is everyone using for DashCast? I'm trying:

DashCast  -vf dshow  -vres 640x480 -vfr 30 -v video="Integrated Webcam" -live -low-delay -frag 200 -insert-utc -seg-marker eods -min-buffer 0.2 -ast-offset -800 -pixf yuv420p

Along with the -cors flag enabled in the server.

Once I have everything working, I'll write up a blog post and link to it from here. Or maybe I'll live stream you the answer. ;)

@nickdesaulniers Any update on that blog post? We're having a similar issue trying to stream videos encoded in DashCast over Chrome on dash.js

@ayuk23 thanks for the interest. I've put down MSE for the time being as Google and Mozilla work together to improve compatibility between MSE and DASH client implementations.

@cconcolato
Regarding your previous post...

"Thanks for the feedback. The program has only been tested with MP4Client as a client. Its use would be limited with browsers as there is currently no reliable way to get chunks into a web application when the HTTP download uses chunk transfer encoding. Still, it would be good to have the server work (in normal mode) with browsers. So regarding the CORS problem, you can try patching the code to add the headers with each request, or only segment requests. We'd be happy to integrate a pull request."

Does this mean that using Osmo4 player integrated into a browser won't work, or is this a possible solution for a low-latency dash player on a browser?

it would be a possibility, since as a browser plugin osmo4 still uses its own network stack.
However our browser integration is outdated and I doubt it still works with firefox ...