DELIBERATE REPOST EXPLANATION
I posted this topic about 6 weeks ago, it got automatically closed, then @lananelson from Twitter replied - but I’m unable to reply, so that’s why I’m posting again.
On 6 Dec 2021 Lana replied:
Hi @mikbyrne! Sorry about the late follow-up here. Could you provide an example of a web page with the embedded Tweets that exhibit this behavior?
Lana, this behaviour is specifically around using embedded tweets within an iOS mobile app, so I don’t really have any link to share.
ORIGINAL POST
OK, I realise I’m asking a pretty specific question here, but I haven’t been able to crack this one on my own.
I have a WKWebView and I’m using it to render an embedded timeline of tweets from a single account. So the HTML loaded into the webview looks like:
I’m embedding the timeline of a twitter account in an iOS app. I have a WKWebView and I’m using it to render an embedded timeline of tweets from a single account. So the HTML loaded into the webview looks like:
<html>
<head>
<meta id=""mw-viewport"" name=""viewport"" content=""width=device-width, minimum-scale=1, maximum-scale=1, initial-scale=1.0""/>
<meta charset=""utf-8"" />
</head>
<body style='padding: 0; margin: 0'>
<a class="twitter-timeline" href="https://twitter.com/WeMakeApps?ref_src=twsrc%5Etfw">Tweets by WeMakeApps</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</body>
</html>
It all loads just great and I’ve even implemented the WKWebViewNavigationDelegate so links open up in Safari.
For tweets that include a YouTube link you get this poster image of the YouTube video with a blue button with a white border and triangle. You tap that button and then the element reloads with an embedded YouTube player. Now you have to tap again to actually play the video.
I’ve tried changing the WKWebViewConfiguration.mediaTypesRequiringUserActionForPlayback property to .none (also the deprecated WKWebViewConfiguration.requiresUserActionForMediaPlayback property), but neither change the behaviour.
When these tweets are loaded in a desktop browser, they look similar but then YouTube videos start auto playing after the YouTube player loads (so just one click). If I load Twitter on Safari on my phone, I still need 2 taps (like the embedded version).
Thanks!