Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROTOCOL: JS API FETCH STREAM for flv.js #798

Closed
winlinvip opened this issue Mar 6, 2017 · 16 comments
Closed

PROTOCOL: JS API FETCH STREAM for flv.js #798

winlinvip opened this issue Mar 6, 2017 · 16 comments
Assignees
Labels
Feature It's a new feature. TransByAI Translated by AI/GPT.
Milestone

Comments

@winlinvip
Copy link
Member

winlinvip commented Mar 6, 2017

Reference: #691 (comment)
It seems that there is a new JS API that supports streaming reading with GET. However, it is unclear whether SRS needs to provide support for this or if standard HTTP GET is sufficient. Therefore, creating this bug to track it.

TRANS_BY_GPT3

@winlinvip winlinvip added the Feature It's a new feature. label Mar 6, 2017
@winlinvip winlinvip added this to the srs 3.0 release milestone Mar 6, 2017
@xqq
Copy link

xqq commented Mar 6, 2017

It is a standard HTTP GET, both chunked or non-chunked are acceptable.

TRANS_BY_GPT3

@xqq
Copy link

xqq commented Mar 6, 2017

Just need to add the header 'Access-Control-Allow-Origin' to the output, you can try playing with flv.js.

TRANS_BY_GPT3

@ChandZhang
Copy link
Contributor

ChandZhang commented Mar 7, 2017

Tested on version 3.0.18, it also needs to be added in the Header. The output of the Chrome test is as follows:
Fetch API cannot load http://192.168.1.242:8080/app/test.flv. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.1.241' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

TRANS_BY_GPT3

@hman190
Copy link

hman190 commented Mar 9, 2017

Hello, I tried using flv.js to play http flv, but I still encountered the error message "Fetch API cannot load http://.../live/livestream.flv. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://...' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled." How can I resolve this issue? Thank you.

TRANS_BY_GPT3

@ChandZhang
Copy link
Contributor

ChandZhang commented Mar 9, 2017

You can temporarily use a proxy. Refer to #722 @hman190

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Mar 11, 2017

Just enable crossdomain, refer to the configuration.

TRANS_BY_GPT3

@ChandZhang
Copy link
Contributor

ChandZhang commented Mar 11, 2017

I enabled crossdomain but it didn't work. I'll try again later.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Mar 11, 2017

Make sure to open it in http_server, and if there are any issues, please provide feedback.

http_server {
    crossdomain     on;
}

TRANS_BY_GPT3

@ChandZhang
Copy link
Contributor

ChandZhang commented Mar 13, 2017

Now it's good.
Just saw that there is a fix later.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

Great~

@janyo1201
Copy link

janyo1201 commented Jun 3, 2017

hi winlinvip
I am testing the version of SRS 2.0.243.
http_server {
crossdomain on;
}

Will there be support for version SRS2.0.243 when there is an error at startup?
[2017-06-03 14:22:58.662][error][1955][0][0] unsupported http_stream directive crossdomain, ret=1023

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Jun 3, 2017

SRS3 can support it, but it has not been released.

TRANS_BY_GPT3

@LF-DevJourney
Copy link

LF-DevJourney commented Jul 31, 2017

I compiled using the latest source code, but still have this issue.

TRANS_BY_GPT3

@LF-DevJourney
Copy link

LF-DevJourney commented Jul 31, 2017

When using flv.js to play FLV, there is a cross-origin issue. To solve this, add w->header()->set("Access-Control-Allow-Origin", "*"); after srs_app_http_stream.cpp#485 to set Access-Control-Allow-Origin. For security reasons, * can be replaced with a specific value.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Jan 4, 2018

I will supplement the issue of cross-domain once again:

  1. Use HTTP proxy to solve cross-domain, such as https://github.com/ossrs/go-oryx/tree/develop/httpx-static
  2. It has been solved in SRS3, but this modification is quite significant and has not been merged into SRS2. If you want to add it in SRS2, you can refer to the method mentioned above, although it is not the best solution (because it adds this header even in non-cross-domain situations), but it can work without any problem.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

Dup to #717 #798 #1002 #1025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature It's a new feature. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

6 participants