# Twitter (and Dailymotion) video onebox autoplays without user interaction

**URL:** https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926
**Category:** Bug
**Created:** [5 februari 2017 om 00:03 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926 "2017-02-05T00:03:23Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [5 februari 2017 om 00:03 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/1 "2017-02-05T00:03:23Z")

</div>

When a video from twitter is oneboxed, it seems to auto-play without any user interaction. This is quite obnoxious. For example

> <https://twitter.com/UniofNottingham/status/827966230568988672/video/1>

`https://twitter.com/UniofNottingham/status/827966230568988672/video/1`

---

<div class="post-metadata">

### Author: ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)
#### Post date: [5 februari 2017 om 01:02 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/2 "2017-02-05T01:02:52Z")

</div>

I am having a similar issue with videos, but can’t say whether it’s restricted to Twitter or not.

The below thread has an embedded video in the 15th post, but it plays whether you like it or not.

[http://forum.singletrackbc.com/t/ama-supercoss-2017/345](http://forum.singletrackbc.com/t/ama-supercoss-2017/345)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [5 februari 2017 om 01:08 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/3 "2017-02-05T01:08:46Z")

</div>

> [@ron\_jeremy](#):
>
> can’t say whether it’s restricted to Twitter or not.
> 
> The below thread has an embedded video in the 15th post

Your example looks like a Dailymotion video, so this isn’t just restricted to Twitter.

I’m not really sure what the solution is here, as Discourse doesn’t have any control of what is inside an iframe… ☹

---

<div class="post-metadata">

### Author: ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)
#### Post date: [5 februari 2017 om 01:39 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/4 "2017-02-05T01:39:17Z")

</div>

It’s annoying as hell.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5 februari 2017 om 02:23 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/5 "2017-02-05T02:23:45Z")

</div>

It is not autoplaying on my iPad right now, so this isn’t a valid statement.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [5 februari 2017 om 05:12 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/6 "2017-02-05T05:12:35Z")

</div>

@ron_jeremy, @david, what browser/device are you using? I’m on Windows 10, Chrome, and am seeing the video autoplay. However, opening this topic on my phone (Android 7.1.1m Chrome) is didn’t…

---

<div class="post-metadata">

### Author: ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)
#### Post date: [5 februari 2017 om 06:02 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/7 "2017-02-05T06:02:14Z")

</div>

> [@jomaxro](#):
>
> what browser/device are you using?

**Lubuntu 16.10**  
Firefox  
Chrome

**MacOS Sierra**  
Chrome  
Safari

The thread I linked to will have DailyMotion videos embedded every week throughout the Supercross season, meaning in a month or two there will be 20 auto-playing videos to greet vieweres of the thread.

**Update**  
I just tested this on my Nexus 6P running Chrome on Android 7.1.1 and the issue does **not** happen. It seems to be a desktop issue across multiple browsers and operating systems.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5 februari 2017 om 06:07 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/8 "2017-02-05T06:07:48Z")

</div>

Remember flash is about to become click to play by default on all browsers. Which it should have been, for years..

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [5 februari 2017 om 12:25 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/9 "2017-02-05T12:25:35Z")

</div>

Running Chrome on Windows 10, the video above does autoplay, and does _not_ appear to be a flash player.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5 februari 2017 om 22:05 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/10 "2017-02-05T22:05:33Z")

</div>

Sure @zogstrip can have a look.

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [20 februari 2017 om 19:45 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/11 "2017-02-20T19:45:17Z")

</div>

Any update on this? I am also getting end-user complaints. Twitter videos to be more specific.

I have not yet investigated thoroughly, but it might be that Chrome’s behaviour has changed recently:

> **[Google Product Forums](https://productforums.google.com/forum/m/#!topic/chrome/2c2JsQFohoo)**

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [20 februari 2017 om 20:15 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/12 "2017-02-20T20:15:36Z")

</div>

The reason this isn’t an issue on iPad/Android is because those browsers will not allow a video element **with sound** to play without user interaction. Desktop browsers do not have this restriction.

These articles have information on when videos can autoplay on iOS/Android:

> **[New Policies for iOS](https://webkit.org/blog/6784/new-video-policies-for-ios/)**
>
> Since before your sun burned hot in space and before your race was born, Safari on iOS has required a user gesture to play media in a or element.

[Muted Autoplay on Mobile - Say goodbye to canvas hacks and animated GIFs! &nbsp;|&nbsp; Blog &nbsp;|&nbsp; Chrome for Developers](https://developers.google.com/web/updates/2016/07/autoplay)

I think this is a change from Twitter/Dailymotion rather than a browser thing (i.e. they’ve set the autoplay attribute on the video elements inside the iframes)

Using the example in my first post, the link I pasted has this tag in the `<head>`

```plaintext
<link rel="alternate" type="application/json+oembed" href="https://publish.twitter.com/oembed?url=https://twitter.com/UniofNottingham/status/827966230568988672" title="Uni of Nottingham on Twitter: &quot;Highlights from @LakesideArts digital show celebrating #ChineseNewYear 🐓 https://t.co/yWujAUIFNw&quot;">

```

which links to:

> **O-embed JSON**
>
> ```plaintext
> {  
> "url":"https:\/\/twitter.com\/UniofNottingham\/status\/827966230568988672",
> "author_name":"Uni of Nottingham",
> "author_url":"https:\/\/twitter.com\/UniofNottingham",
> "html":"\u003Cblockquote class=\"twitter-tweet\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003EHighlights from \u003Ca href=\"https:\/\/twitter.com\/LakesideArts\"\u003E@LakesideArts\u003C\/a\u003E digital show celebrating \u003Ca href=\"https:\/\/twitter.com\/hashtag\/ChineseNewYear?src=hash\"\u003E#ChineseNewYear\u003C\/a\u003E \uD83D\uDC13 \u003Ca href=\"https:\/\/t.co\/yWujAUIFNw\"\u003Epic.twitter.com\/yWujAUIFNw\u003C\/a\u003E\u003C\/p\u003E&mdash; Uni of Nottingham (@UniofNottingham) \u003Ca href=\"https:\/\/twitter.com\/UniofNottingham\/status\/827966230568988672\"\u003EFebruary 4, 2017\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E",
> "width":550,
> "height":null,
> "type":"rich",
> "cache_age":"3153600000",
> "provider_name":"Twitter",
> "provider_url":"https:\/\/twitter.com",
> "version":"1.0"
> }
> 
> ```

This is a javascript based embed, which I believe Discourse ignores because it is variable height and so risks breaking scrolling ☹

Instead, it seems like Discourse is using the `og:video` property, which is a link to a page with the video autoplaying. If you visit that URL, and remove the `embed_source=facebook` parameter then it doesn’t autoplay any more. I suspect twitter have done this so that their videos autoplay when people share them on Facebook.

```plaintext
<meta property="og:video:secure_url" content="https://twitter.com/i/videos/827966230568988672?embed_source=facebook">

```

Note that currently a link to a twitter video does not match the custom “Twitter Status Onebox”, since the URL is not to a status, but to a video:

> <https://github.com/discourse/onebox/blob/main/lib/onebox/engine/twitter_status_onebox.rb#L8>

So I _think_ the only way this can be solved on the Discourse end is by implementing a “Twitter video” onebox which takes the `og:video` URL and removes the `embed_source=facebook` parameter…

Does anyone have any tidier ideas?

---

<div class="post-metadata">

### Author: ![gkln](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gkln/32/293382_2.png) [@gkln](https://meta.discourse.org/u/gkln)
#### Post date: [12 maart 2017 om 10:23 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/13 "2017-03-12T10:23:24Z")

</div>

Came here to report the same issue with Dailymotion videos. Is there a way to disable video embedding of a specific platform until this issue get fixed?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [12 maart 2017 om 11:39 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/14 "2017-03-12T11:39:26Z")

</div>

The “onebox domains blacklist” setting in the admin panel could be used to disable oneboxing for dailymotion. You’ll need to add “[www.dailymotion.com](http://www.dailymotion.com)”.

Note that any existing posts with oneboxes will need to be “rebaked” for this to take effect - easiest way to do this is to click the wrench below a post and click “rebuild HTML”

Also, onebox does a lot of caching, so it may take a bit of time for the blacklist to take effect 🙂

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [17 maart 2017 om 21:03 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/15 "2017-03-17T21:03:44Z")

</div>

I’ve just submitted 2 PRs, one to discourse/onebox and one to discourse/discourse. These together should hopefully fix all the twitter-related issues in this thread.

[https://github.com/discourse/onebox/pull/347](https://github.com/discourse/onebox/pull/347)

[https://github.com/discourse/discourse/pull/4766](https://github.com/discourse/discourse/pull/4766)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [17 maart 2017 om 21:25 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/16 "2017-03-17T21:25:46Z")

</div>

And while I’m at it, here’s a PR to stop autoplay on dailymotion

[https://github.com/discourse/onebox/pull/348](https://github.com/discourse/onebox/pull/348)

---

<div class="post-metadata">

### Author: ![SimeonGriggs](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@SimeonGriggs](https://meta.discourse.org/u/SimeonGriggs)
#### Post date: [3 april 2017 om 04:18 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/17 "2017-04-03T04:18:33Z")

</div>

This is still a problem?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [3 april 2017 om 08:31 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/18 "2017-04-03T08:31:16Z")

</div>

Yes it is, still waiting on the Pull requests to be merged in

---

<div class="post-metadata">

### Author: ![SimeonGriggs](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@SimeonGriggs](https://meta.discourse.org/u/SimeonGriggs)
#### Post date: [3 april 2017 om 08:46 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/19 "2017-04-03T08:46:48Z")

</div>

It’s also an issue when a direct URL to a video is turned into an HTML video, it autoplays.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [3 april 2017 om 09:05 UTC](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926/20 "2017-04-03T09:05:45Z")

</div>

Hmm… I’m not sure why that would be the case - the basic video onebox doesn’t add the autoplay attribute as far as I can see

> <https://github.com/discourse/onebox/blob/main/lib/onebox/engine/video_onebox.rb#L15>

Please can you post an example here on meta?

[Next page](https://meta.discourse.org/t/twitter-and-dailymotion-video-onebox-autoplays-without-user-interaction/56926.md?page=2)
