Play Youtube video in background using youtube player api

前端 未结 2 915
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 23:56

I have successfully played youtube video using youtube player api. But I need to run it in background on back button press.I have googled a lot but found nothin

相关标签:
2条回答
  • 2021-01-03 00:37

    Check the state of the player when the back button is clicked, i think it will be in paused and or buffering state. you can try patching it on the listeners, onbuffering listener, call playvideo/ change state to playing video. I tried and had it worked for iOS, dont know the platform limitations on this context.

    0 讨论(0)
  • 2021-01-03 00:43

    I searched for that topic and I found that there is not an official way and won't be according to this page on Google code.

    In it they propose that you create a player.

    Hide the player.

    Mute the player.

    Call seekTo() with your videoId and optional offset.

    Wait for state change to "playing".

    Press pause.

    Call seekTo(originalOffset, false).

    Unmute the player.

    Show the player. (or whatever).

    It maybe doesn't do what you need but maybe you can change what you need to achieve your goal using this method.

    0 讨论(0)
提交回复
热议问题