harmonwood / capacitor-video-player

Capacitor Video Player Plugin
MIT License
116 stars 46 forks source link

CapacitorVideoPlayer.getCurrentTime always returns 0 #143

Open ChryS43 opened 10 months ago

ChryS43 commented 10 months ago

With this portion of the code I'm trying to create a setInterval for a future network request setting, except that the getCurrentTime returns me to the value property always 0, unless it advances manually with the videoplayer

  handleSelectedVideo(lezione: any, index: any) {
    this.videoPlayer.initPlayer(this.startVideoFromLink(lezione.link))
      .then((succ) => {
        this.videoPlayer.setCurrentTime({playerId: "vpl", seektime: 600}).then((success) => {
          setInterval(() => {
            this.videoPlayer.getCurrentTime({playerId: "vpl"}).
            then((res) => {
              alert(JSON.stringify(res))
            })
          }, 5000)

        })
        .catch((err) => console.log(err));
        })

  }