Youtube player does not work on iOS

Asked

Viewed 91 times

2

Guys with a problem here with youtube videos, I have it as option music player on the site in the bottom right, it works normal except on iOS mobile devices, what happens is that I can not play music.

Follow one of the sites that contains the player. website

player = new YT.Player(attrs.container, { 
    height: '200', 
    width: '200', 
    videoId: getIdFromUrl(videoUrl), 
    playerVars: { 
        html5: 1,
        enablejsapi: 1, 
        playsinline: 1 
        //origin: extraService.site_root_url.replace('http:', 'https:') 
        //origin: extraService.site_root_url 
    }, 
    events: { 
        'onReady': onPlayerReady, 
        'onStateChange': onStateChange 
    } 
});

this is the iframe he generates for me:

<iframe id="sdn-player" frameborder="0" allowfullscreen="1" title="YouTube video player" width="200" height="200" src="https://www.youtube.com/embed/2RtzSLLngc8?enablejsapi=1&amp;playsinline=1&amp;origin=https%3A%2F%2Fnoivos.casar.com"></iframe>
  • You use some function to give play ?

  • Place the property in your CSS cursor:pointer: on the Play button.

  • already have this css on the button

  • Sorry, I didn’t mean to offend you. Put that variable html5: 1, within the playerVars. And put in your POST the functions OnPlayerReady and OnStateChange.

  • @Diego-Souza did not understand the part of the POST

  • POST is what you posted here on the site. Edit your question and put the functions I said so we can see what they perform

  • But the functions Onplayerready and Onstatechange already have, this at the end in Events

  • You didn’t put the comma after the html5: 1.

  • ready I put the comma

  • The problem is where @Diego Souza spoke, is missing a comma in the html5: 1, ends up generating a javascript error. onPlayerReady and onStateChange are just callbacks

  • Even with Html5: 1, it didn’t work, the player still doesn’t run on iOS and only this player that doesn’t run, because putting a normal video on the page it runs.

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.