-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Forward: Fetch the URL to forward from a backend, dynamic forwarding, on-demand forwarding, forwarding Hook. #1342
Comments
It's a good idea to change the forward url in config to dynamic url, which is fetched from backend api. |
Check it in next release. |
this feature is very useful and import for me ,please release it as soon as possible,thanks |
Also need to carry the right vhost, #1213 |
Or parse the url from the publish url query string, #53 |
Use scenario by https://github.com/clime
|
Thank you @chundonglinlin for providing the Forward scenario used in actual business. Please refer to #2799 (comment) After some consideration, I realized that all these scenarios can actually be achieved by improving the fourth scenario. By configuring dedicated backend services, we can achieve these forwarding operations, for example:
If the Verify the mentioned scenario:
Additionally, points to consider:
Please update this issue as an important reference material.
|
Thank you, Boss Yang, for providing the specific plan. I will reorganize the logic and proceed with the implementation. One additional point to note is that the users need to have the ability to build the backend service after incorporating the above mentioned scenarios.
|
Yeah, that's right. Except for scene one, which has default forwarding, all the other scenes require independent backend server support. I think this is the future direction because it allows for complex business logic to be placed on external servers, which can be implemented using Go or Node.js. This way, stability and flexibility are also improved. This backend server can share the same set of APIs with the HTTP callback, so please ensure that the APIs are not conflicting when designing them.
|
Currently, after implementing one version, it was found that scenario five cannot be covered. Scenario five is the logic actively transmitted by the backend service, while scenarios one to four belong to the operation of unidirectional query and creation of relay. Is it necessary to support something similar to SrsGoApiForwarder? Explanation of the backend API interface /api/v1/forward: Request:
POST /api/v1/forward
{
"action": "on_forward",
"server_id": "vid-k21d7y2",
"client_id": "9o7g1330",
"ip": "127.0.0.1",
"vhost": "__defaultVhost__",
"app": "live",
"tcUrl": "rtmp://127.0.0.1:1935/live",
"stream": "livestream",
"param": "?auth_token=xxx&forward=rtmp://ossrs.net/live/livestream"
}
Response:
{
"code": 0,
"data": {
"forwards":[{
"url": "rtmp://ossrs.net:1935/live/livestream?auth_token=xxx"
},{
"url": "rtmp://aliyuncdn.com:1935/live/livestream?auth_token=xxx"
}]
}
}
|
…der to other server.(ossrs#1342)
Scene five may be a type of requirement that is strongly related to the business, relatively more complex, and how to cover and test these scenes is a big issue, so let's first support forwarding backend in simple scenes.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@MohammadZarifiyan If want some discussion, here's the discord. |
Another solution is to expand the return value of "on_publish" and directly return "whether to enable DVR", "forward list", etc. This way, the required status will be initialized when the source is initialized and there is no need to worry about the status issues during the streaming process.
|
@ximenpo, returning from As for the management of the source's state, it belongs to the specific implementation and is unrelated to any specific callback. The interface and implementation have no connection and should not have any connection. They should be considered independently. The interface only needs to consider whether it meets the expectations and assumptions in terms of usage, while the implementation can be continuously adjusted. What is an assumption that meets usage requirements? Users who use "on_publish" are typically responsible for authentication and event handling, and they may not necessarily be aware of the concept of "Forward". On the other hand, "Forward" is often used for stream forwarding, which is related to system integration, and they may not be concerned about events.
|
…der to other server.(ossrs#1342)
…der to other server.(ossrs#1342)
* Forward: add backend config and demo server for dynamic create forwarder to other server.(#1342) * Forward: if call forward backend failed, then return directly. * Forward: add API description and change return value format. * Forward: add backend conf file and wrapper function for backend service. * Forward: add backend comment in full.conf and update forward.backend.conf. * Forward: rename backend param and add comment tips.
…2799) * Forward: add backend config and demo server for dynamic create forwarder to other server.(ossrs#1342) * Forward: if call forward backend failed, then return directly. * Forward: add API description and change return value format. * Forward: add backend conf file and wrapper function for backend service. * Forward: add backend comment in full.conf and update forward.backend.conf. * Forward: rename backend param and add comment tips.
Wiki
Usage
Start backend server:
Start master SRS enables forwarding with backend:
Start slave SRS server, to which forward by master:
Publish to master by FFmpeg:
Play the stream:
rtmp://127.0.0.1:1935/live/livestream
rtmp://127.0.0.1:19350/test/teststream
Note that you could change the backend urls by:
srs/trunk/research/api-server/server.py
Line 884 in e222f0d
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: