onPlay()

in web/reactplayer/src/Components/VideoJSPlayer.js [181:208]


  onPlay(e) {
    // console.log("In play",e);
    //if player is not initialized yet, do nothing
    if(!this.player)return;

    let videoUrl = this.state.videoUrl;

    if (videoUrl) {
      //for dash packaging
      if (videoUrl.endsWith(".mpd")) {
        this.player.src({
          src: videoUrl,
          type: 'application/dash+xml'
        });
      } else {
        this.player.src(videoUrl);
      }

      var videoId = this.getVideoId(this.player.src());
      // console.log("videoid ",videoId);
      this.setState(oldState => ({
        trails: [],
        videoid: videoId
      }));
      this.sdk.initialize(videoId);
      this.player.play();
    }
  }