jbilcke-hf HF staff matthoffner commited on
Commit
cd0c4c8
1 Parent(s): d96076f

Add play button for devices with autoplay restrictions (#1)

Browse files

- Add play button for devices with autoplay restrictions (14bc85b9162899df4b000aa14f9a51c3ef1eb7fd)


Co-authored-by: Matt Hoffner <matthoffner@users.noreply.huggingface.co>

Files changed (1) hide show
  1. public/index.html +8 -0
public/index.html CHANGED
@@ -45,6 +45,14 @@
45
  }, 1200)
46
  }, false);
47
 
 
 
 
 
 
 
 
 
48
  player.play()
49
  }
50
  })()
 
45
  }, 1200)
46
  }, false);
47
 
48
+ // Handle autoplay restrictions.
49
+ var promise = videoElement.play();
50
+ if (promise !== undefined) {
51
+ videoElement.addEventListener('click', function() {
52
+ videoElement.play();
53
+ });
54
+ }
55
+
56
  player.play()
57
  }
58
  })()