Play Youtube video in background using youtube player api

前端 未结 2 946
伪装坚强ぢ
伪装坚强ぢ 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条回答
  •  梦毁少年i
    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.

提交回复
热议问题