oEmbed is an open format designed for embedding content from one site into another, by obtaining an HTML embed code (iFrame). From now on, the platform's Live stream, Image and embed resources allow consumers can quickly obtain this code through the implementation of oEmbed API.
It is quite simple and we will show you how to do it here.
1. First, the mediastream oEmbed path is as follows:
https://mdstrm.com/oembed, in addition, you must also use the URL path of the platform content, as required by the oEmbed API, it must be encoded, so you can use online encode-decode pages to obtain it.
2. From platform, and according to the selected content, we must create the required url, as mentioned, in each available resource we must add the corresponding ID of the content:
3. Obtain the encode URL; as an example we take the id of a media content:
the URL encode would be as follows:
4. Once the url path is obtained, the user must send an HTTP request in the following format:
This path is then copied and pasted into the browser, the obtained response will come under the default JSON format or as an xml, using the example of the content embed, the response to the request would be the following:
"html": "<iframe src='//mdstrm.com/embed/61a54bef57d6af082df8d14f' width='640' height='360' allow='autoplay; fullscreen; encrypted-media' frameborder='0' allowfullscreen allowscriptaccess='always' scrolling='no'></iframe>"
The data provided shows the current version of oEmbed, the name of the provider and its url, the type of the requested resource, the title, the thumbnail (it uses by default the one selected as the main one), the size of the thumbnail width and height and the corresponding HTML code for insertion.
If we embed the code in a test website, the clip plays immediately.
The JSON response is similar in all cases of available resources.
You can consult the official open oEmbed documentation at the following link: https://oembed.com/
To be considered
For content with closed access (token), oEmbed will provide the JSON format, however if the insertion code is implemented in a web, it displays the Invalid Token alert; in this case and only if it is necessary to share the content, the corresponding consumption token must be added to the iframe received in the JSON from oEmbed; the same result is presented in case of encoding the platform url using the token as a query string inserted in it
If the generated encode URL is not the right one, at the moment of making the HTTP request it will give
Not Foundas a response.
If you have any additional questions, feel free to contact us through the chat.
Atte: Mediastream team