Add Microsoft Stream (Classic) videos to other apps by using oEmbed

Warning

Microsoft Stream (Classic) is being retired and replaced by Stream (on SharePoint) and Microsoft Teams live events. It is recommended to start using Stream (on SharePoint) by uploading videos to SharePoint, Teams, Viva Engage, or OneDrive, and to run your live events through Teams and Viva Engage.

Functionality in Stream (Classic) will be changed and removed leading up to the retirement date. Learn more about Stream (on SharePoint)...

Stream (Classic) uses a simplistic version of an oEmbed implementation in order to allow applications to dynamically get the embed code of a given video or channel. Because this is a simplistic version of the oEmbed specification, and for security purposes, the returned values for title, thumbnail, description, author information, etc., is all listed as generic information.

An application can simply embed a video or channel from the returned oEmbed response, and the metadata information will be displayed automatically after a known authorized user sees the content. As a reminder, only authorized users are able to see secure content in Microsoft Stream, regardless of where it is embedded.

To learn more about oEmbed, visit the official oEmbed documentation.

An example scenario

An example scenario of how this can help an application developer is the Stream (Classic) collaboration with OneNote or Yammer. In both cases, a user simply adds a URL from Microsoft Stream (Classic) to either their note or conversation thread.

The application then takes the input Stream (Classic) URL and gets the embed code from the html value of the oEmbed response. The application renders the embed code so that an authorized, signed in user can watch content inline.

Detecting a Microsoft Stream (Classic) URL

Detecting a Stream (Classic) URL is easy. Video URLs follow the pattern of:

https://*.microsoftstream.com/video/ID

Stream (Classic) channels follow the pattern of:

https://*.microsoftstream.com/channel/ID

oEmbed endpoint

The Stream (Classic) oEmbed endpoint can be reached at https://web.microsoftstream.com/oembed with addition of the supported query parameters.

Supported parameters

Parameter Required? Value Notes
URL required string: URL encoded string URL for a Microsoft Stream (Classic) video or channel. Video URLs from Microsoft 365 Video are also supported.
autoplay optional boolean: true/false When true, the video will automatically start playing as soon as the user is logged in, if supported by the platform. Applies to videos only. Default is false.
width optional int width in pixels. It is recommended that the width to height ratio is 16:9. Default is 640px for a video.
height optional int height in pixels. It is recommended that the width to height ratio is 16:9. Default is 360px for a video.
preload optional auto/none Setting preload to auto automatically fetches the video chunks when the platform allows it. Setting preload to none waits until the user selects the play button before fetching the video chunks. Default is none.
st optional int Set this parameter to start the video at the value in seconds. Applies to Microsoft Stream (Classic) videos only.

Example

A consumer makes the following HTTP requests:

https://web.microsoftstream.com/oembed?url=https%3A%2F%2Fweb.microsoftstream.com%2Fvideo%2Ff6df81b2-9438-4154-b32c-c023ebb2a4e3&preload=none&autoplay=false&width=1280&height=720

The response is returned as follows:

{
    "type": "video",
    "version": "1.0",
    "title": "",
    "provider_name": "Microsoft Stream",
    "provider_url": "https://stream.microsoft.com",
    "embed_url": "https://web.microsoftstream.com/embed/video/f6df81b2-9438-4154-b32c-c023ebb2a4e3?autoplay=false&preload=none",
    "html": "<iframe width=\"1280\" height=\"720\" src=\"https://web.microsoftstream.com/embed/video/f6df81b2-9438-4154-b32c-c023ebb2a4e3?autoplay=false&preload=none\" frameborder=\"0\" allowfullscreen><iframe>",
    "width": 1280,
    "height": 720,
    "thumbnail_url": "https://amsglob0cdnstream11.azureedge.net/oembed/images/poster_1280x720.jpg"
}

See also

How Stream (Classic) works with other products