播放完一个视频后, 再播放另外一个视频, iOS(浏览器) 播放失败


@ccclass('Test')
export class Test extends Component {
  @property(Node)
  startNode: Node;
  @property(VideoPlayer)
  startVideo: VideoPlayer;

  @property(Node)
  resultNode: Node;
  @property(VideoPlayer)
  resultVideo: VideoPlayer;
  @property(Node)
  resultVideoNode: Node;

  start() {}

  init() {
    const { startNode, startVideo, resultNode, resultVideo, resultVideoNode } = this;
    startNode.active = true;
    startVideo.play();
    startNode.on(
      VideoPlayer.EventType.COMPLETED,
      () => {
        startNode.active = false;
        resultNode.active = true;
        resultVideo.play();
        const a = this.getComponent(Animation);
        a.play();
        resultVideo.playOnAwake = true;
        resultVideoNode.on(
          VideoPlayer.EventType.COMPLETED,
          () => {
            console.log(234);
          },
          this
        );
      },
      this
    );
  }

  update(deltaTime: number) {}
}

PC(mac) 可以正常播放第一段视频, 完了之后, 正常播放第二段视频.

但是 手机上 第一段视频能正常播放, 第二段视频就放不了了.( iOS 浏览器)

this.schedule(() => {
          console.log(resultVideo);
          console.log(resultVideo.state);
          resultVideo.play();
        }, 2);

设置了一个一直尝试播放的任务.

PC 上显示的状态有 playing/completed, 是正常的.

手机上就一直显示的是none. 这会是什么问题呢?

image

看到了这位大佬的骚操作…

现在变成了 stopped, 但是一直是 stopped,

监听 state 变化的定时任务, 在 stopped 的地方执行 play()/resume()

都没有效果.

人都麻了…