Skip to content

Videos Out of Sync #19

Description

@selected-pixel-jameson

Hello,

I'm using the TimingSrc script in combination with the mediasync library.

This is being implemented in an Angular project. I have included the references to the timingsrc-v2.js and mediasync.js in the index.html file.

My implementation looks like this.

async refreshVideoPanels(jam: IJam, extension: string) {
    if (jam) {

      this.syncs.forEach(sync => {
        sync.stop()
      })

      this.videos = []
      this.syncs = []

      delete this.timingObject
      this.timingObject = new TIMINGSRC.TimingObject({ range: [0, 360] });
      await this.timingObject.ready
      this.maxVideoLength = 0


      jam.tracks.forEach((trackRelation: ITrackRelation) => {
        // We need to pass the extension in here because we can't load the
        // same video fro all browsers.
        this.setPanelSource(trackRelation.track.id, trackRelation.track.getTrackURL(extension))
        const video = document.getElementById(`${trackRelation.track.id}`) as HTMLVideoElement;
        video.volume = trackRelation.volumeLevel || 1
        video.muted = false
        this.videos.push(video);
      })

      //await this.waitForVideosToBeReady()
      this.determineMaxDuration(jam)
      this.timingObject.on("timeupdate", this.progressUpdate)


      this.videos.forEach((video, index) => {
        if (!video.src.includes('#')) {
          this.syncs.push(MCorp.mediaSync(video, this.timingObject));
          if (index !== 0) {
            this.syncs[index].setSkew(0.09);
          }
        }
      })
    }
  }

As new videos are added to the page the video panels are refreshed and have the source added. The page is not refreshed at all.
As more videos are added or updated they are not syncing when playing back.

If we refresh the page manually the videos will all sync up correctly.

I was just wondering if there's anything I'm missing that would cause the videos to be out of sync?

Thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions