Forum Discussion
How to control the embedded Streams player
phil444 From what I understand there aren't any API hooks for this. We only have some details on the embed here:
https://docs.microsoft.com/en-us/stream/portal-embed-video
https://docs.microsoft.com/en-us/stream/embed-video-oembed
For future planning what things are you interested in? When you see it is stopped or paused to do you want to put an overlay? Are you trying to see if stopped at 55% of the way through? If you had some hooks what you would want to do with it? What are you building on top of the Stream videos if I may ask? Thank you for the feedback.
- phil444Jan 08, 2021Copper Contributor
descapa_msft When you see it is stopped or paused to do you want to put an overlay?
I need to know if it is stopped or playing, so that I can update my live usage statistics database in real-time. Going the other way, when I have a scheduled event, for example, my player would show a clock and message before the event starts, then our TV operations center can send a command to start the event when the speaker is ready. So in the page, the Streams player needs to "start" when I fire the event at it. Also, maybe the event will end early, or late. Again, I need to be able to command the remote players to stop and unload if our producer ends the event.
This is simple stuff on your end to implement.
Maybe something like a function that receives "start", "stop".
And a listener that responds with "idle", "playing", "buffering", "error".
- phil444Jan 08, 2021Copper Contributor
We have our own system that we developed 22 years ago. I want to enable the community to use new tools as they become available, and to integrate with other technologies. I could see some scientists wanting to do their own one-off videos using Streams, but also taking advantage of our massive user base, and intelligent search algorithms and countless other reasons...
We already have tested streaming from our system TO Streams. That was easy. But now I want to be able to take someone's Streams event and be able to host it on OUR platform, in real time. I can do with other platforms, for example YouTube, as they have a hooks in their iframe player that let me control it and get feedback about it's status. That's basically all I need and I can take it from there.
If I just use the simple embed code Streams gives me, it plays, but I have absolutely no control over it, and no way to update my database with real-time statistics, and so on.
Here's a little code snippet from my controller for a YouTube embedded player.
var player;var playerstatus;playerstatus = 'stopped';function onYouTubeIframeAPIReady() {}function launch() {player = new YT.Player('player', {videoId: '<%= rs("YouTube") %>',playerVars: {autoplay: 1, // Auto-play the video on loadcontrols: 1, // Show pause/play buttons in playermodestbranding: 1, // Hide the Youtube Logoiv_load_policy: 3, // Hide the Video Annotationsautohide: 1 // Hide video controls when playing},events: {'onReady': onPlayerReady,'onStateChange': onPlayerStateChange}});