1

iMessage allows rich previews, including embedded videos, in iMessage chats. Traditionally, the open graph tags og:video or og:video_url has an mp4 video url for it's value. However, YouTube has the following tags:

<meta property="og:type" content="video.other">
<meta property="og:video:url" content="https://www.youtube.com/embed/NUTGr5t3MoY">
<meta property="og:video:type" content="text/html">

Instead of an mp4 file, YouTube using og:video:type text/html with og:video_url of an HTML page (with a <video> embedded on it).

I seem unable to replicate this behavior. If I don't specify an mp4 file url, the preview fails to show a video. I am wondering how to replicate https://www.youtube.com/embed/NUTGr5t3MoY's behavior.

I've also taken a look at Embedding html5 video with opengraph on facebook, however it is about Facebook not iMessage, the answer seems outdated, and the question lacks specific details.

JBis
  • 827
  • 1
  • 10
  • 26

2 Answers2

0

Reference video files directly, rather than YouTube links, which will not autoplay. Avoid videos that require HTML or plug-ins; they are not supported. Keep the size of the icon + image + video to 10MB or less.

The video comes from this tag:

<meta property="og:video:url" content="video.mp4">
0

I suspect YouTube might be checking the user agent for iMessage requests and providing a different value for og:video:url vs when a browser requests it in order to enable this. OR Apple has some custom code making the embed work since YouTube videos are so popular.

I've been able to get iMessage videos to unfurl by providing a valid video link (in my case an adaptive streaming .m3u8 file) in the og:video:url and og:video:secure_url fields. But as the other answer suggests a direct mp4 may work as well.

I still need to figure out the correct iMessage user agent though in order to know when to provide the direct m3u8 instead of the embed player url.

jcaruso
  • 950
  • 11
  • 19