From a44e7c607bc489ad244d28efd0c5596722c86137 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Wed, 11 Mar 2020 11:35:48 +0100
Subject: [PATCH] Fix #1041: Support autoplay when loading embed frame from
 Mastodon and third-party websites

---
 changes/changelog.d/1041.enhancement | 1 +
 front/src/EmbedFrame.vue             | 6 ++++++
 2 files changed, 7 insertions(+)
 create mode 100644 changes/changelog.d/1041.enhancement

diff --git a/changes/changelog.d/1041.enhancement b/changes/changelog.d/1041.enhancement
new file mode 100644
index 0000000000..6c608c160c
--- /dev/null
+++ b/changes/changelog.d/1041.enhancement
@@ -0,0 +1 @@
+Support autoplay when loading embed frame from Mastodon and third-party websites (#1041)
diff --git a/front/src/EmbedFrame.vue b/front/src/EmbedFrame.vue
index 609348899e..ade4717fa6 100644
--- a/front/src/EmbedFrame.vue
+++ b/front/src/EmbedFrame.vue
@@ -145,6 +145,7 @@ export default {
       type: null,
       id: null,
       tracks: [],
+      autoplay: false,
       url: null,
       isLoading: true,
       theme: 'dark',
@@ -174,6 +175,8 @@ export default {
     if (!!params.instance) {
       this.baseUrl = params.instance
     }
+
+    this.autoplay = params.autoplay != undefined || params.auto_play != undefined
     this.fetch(this.type, this.id)
   },
   mounted () {
@@ -380,6 +383,9 @@ export default {
     },
     tracks () {
       this.currentIndex = 0
+      if (this.autoplay) {
+        this.play(this.currentIndex)
+      }
     }
   }
 }
-- 
GitLab