1

I used this url http://www.youtube.com/embed/uGNhirSbWW0?autoplay=1 to auto play this video in my amazon fireTv app using web View, i am getting the video but the video is not playing automatically? How to auto play the video in amazon firetv. any other way to play the youtube video

Grijan
  • 287
  • 5
  • 22

1 Answers1

0

For someone who stumbled upon this problem when using Amazon Web Apps:

Somewhere in your code load Iframe Player API code

var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

Create an iframe and call event.target.playVideo() when onReady event fires

var player;
function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: 'M7lc1UVf-VE',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
      }

Reference

Blz
  • 193
  • 1
  • 2
  • 6