How to control the embedded Streams player

Copper Contributor

I'm looking to use the Streams platform in a few custom events, with the player embedded into our enterprise portal.  I need to be able to do just basic things like load and unload the player, start playing when the event begins, and capture data about the player status (playing, paused, stopped, error).

 

All I've been able to find is a simple embed with an iframe.  Are there hooks to monitor the player so that we can get real-time data with Ajax, for example?

7 Replies

@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.

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 load
                controls: 1,        // Show pause/play buttons in player
                modestbranding: 1,  // Hide the Youtube Logo
                iv_load_policy: 3,  // Hide the Video Annotations
                autohide: 1         // Hide video controls when playing
            },
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });

@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".

Has there been any reply to this? We need to do something similar.

@PeterNeg...nothing so far

@phil444 

2 Years later, is there any update for embed Stream controls same as Youtube embed API?

@Peng_Li76 - Player APIs like how YouTube supports on their iFrame and via SDK aren't available for Stream. We do have the ground work laid for such support but haven't done the work to make it available as a public API. 

 

It looks like someone added this idea which is for the same concept here in our ideas voting forum. Can people who want this add your votes and comments with more details on what APIs you want and what you'd do with them if we added this feature... 

 

Vote and comment here:

Control playback and obtain status of embed video · Community (microsoft.com)