December 30, 2019

Microlink SDK v4.5: Introducing iframe support

Kiko Beats @kikobeats

We released Microlink SDK v4.5.0, introducing a powerful functionality: the ability to embed native iframes 🔥.

Every time you use Microlink SDK, it turns any link a beauty link preview, where the card can be displayed with three size variations: 'small', 'normal' and 'large'.

The card approach improves a lot of the URL preview experience, making it possible for you to adopt it on your own website or application.

However, some domains on Internet (like Instagram, SoundCloud, Spotify, Facebook, Twitter,...) have their own way to embed their content, being the Microlink card displayed less recognizable than using their own way.

Microlink SDK v4.5 introduces the ability to set iframe as media property for using native embed solution always it's available.

The property media takes into consideration the URL preferences, setting up the Microlik API call in order to satisfy the media requirements.

For example, when the URL is an audio provider (like SoundCloud or Spotify) if you set media: ['audio'] you are telling at Microlink API level that you want to detect the streaming source of audio behind the URL, enabling audio for that purpose.

If the audio detection is done successfully, Microlik API will return an audio data field as part of the response that will be used by Microlik SDK for creating the audio preview.

In the same way, in case you prefer to use provider iframes, just need to set media: ['iframe'] for enabling iframe detection.

After that, Microlink API does the magic and returns you the iframe, leveraging into Microlink SDK for embedding it properly.

Note that we are specifying media as a collection. That's because you can add more than one value to be used as fallbacks.

That's specially useful for the cases where the URL provider doesn't support iframe, or you don't know if the URL is exposing and audio/video streaming source to consume.

Providers supported

That's the best part: Any provider that implements oembed specification is supported.

A non exhaustive list of the most common providers could be:

Loading comments...