Closed dprisikar closed 2 years ago
Not a particularly nice way but the player could keep trying to play every second or so when there is an error.
OvenMediaEngine's AdmissionWebhooks allows you to receive events with callback urls when a stream starts/stops.
https://airensoft.gitbook.io/ovenmediaengine/access-control/admission-webhooks
Or you could periodically poll streams information.
https://airensoft.gitbook.io/ovenmediaengine/rest-api/v1/virtualhost/application/stream
After this, it is the role of the application.
Like OvenSpace(https://space.ovenplayer.com/) (https://github.com/AirenSoft/OvenSpace), you can periodically poll your server for stream information, or, smarter, your server can push events over WebSockets to all users. Other than that, there are many ways.
@IanMitchell77 and @getroot, thank you for your inputs.
@getroot is there a simpler way to accomplish this?
Say, there has to be some callback (not sure if it is accessible through the API, though) that makes the Play button spin, while awaiting the media source. Maybe I can poll that?
Or, perhaps, one can access the incoming stream directly from the browser somehow?
Accessing OvenMediaEngine's API from the client side is incorrect. Anyone with access to OvenMediaEngine's API can change your server settings.
Only your web server uses OvenMediaEngine's API, and after that, it is your web server and your client's role.
If you are looking for a simpler way, it would be better to try playing infinitely in the player and get rid of the error message that appears in the player.
I have also noticed that a listener needs to reload a page with the player to connect to an already started streaming, should the listener has already pressed the "play" button before the streaming starts.
I don't quite understand the issue you are struggling with. OvenPlayer does not need to reload the page when starting playback. All you have to do is retry in the player. See demo.ovenplayer.com or space.ovenplayer.com.
If you thought that because of this you need to know when a stream starts, this deserves a bit more explanation.
Thank you for your comments, @getroot.
To explain the page reload part, here is a simple case.
A listener joins a podcast, run by the author. The listener is connected to the stream. The author stops broadcasting, say accidentally reloads her page. The listener gets cut off, and would need to refresh her page to be able to join the streaming again, after the page refresh on the author's end.
I hope I've managed to explain what I mean well 😀
Sorry but I only focus on the issues with OvenMediaEngine and OvenPlayer (that alone spends all my time), so I'll make one last comment.
Take a look at the code at demo.ovenplayer.com. demo.ovenplayer.com will automatically try to reconnect if the connection is suddenly disconnected.
@getroot of course, and thank you very much for your input. You, guys, have built an amazing product, and I hope that, perhaps, me asking questions and making comments here would help you in your further work 😊
Here is what worked for me:
var player = OvenPlayer.create('player_id', {
"mute": false,
"volume": 100,
"sources": [{
"type": "webrtc",
"file": "wss://..."
}]
});
player.on('error', (event) => {
reloadPlayer();
});
function reloadPlayer(){
player.load(
sources = [{
"type": "webrtc",
"file": "wss://..."
}]
);
Hi,
I am working on a sort of a waiting room, where listeners stay until streaming is started on the other end by the author; using OvenLiveKit for the author's input media.
I have also noticed that a listener needs to reload a page with the player to connect to an already started streaming, should the listener has already pressed the "play" button before the streaming starts.
How can I access a callback function that signals that the author has started streaming to the listeners who are already waiting for the streaming (i.e., they have pressed the "play" button before the author started streaming)?
Anyone's help would be very much appreciated!