Advertisement
Trsak

Untitled

Nov 19th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function hoverVideo(i) {
  2. if (playingVideo == null) {
  3. jQuery('.wpst-trailer').attr('playsinline', true);
  4. }
  5.  
  6. if (playingVideo && playingVideo != i) {
  7. hideVideo(playingVideo);
  8. } else if (playingVideo && playingVideo == i) {
  9. return;
  10. }
  11.  
  12. playingVideo = i;
  13. var playPromise = jQuery('.wpst-trailer')[i].play();
  14. if (playPromise !== undefined) {
  15. playPromise.then(_ => {
  16. // Automatic playback started!
  17. // Show playing UI.
  18. })
  19. .catch(error => {
  20. // Auto-play was prevented
  21. // Show paused UI.
  22. });
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement