Skip to content

Commit

Permalink
client: fix vimeo player not respecting seeks (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 committed May 11, 2024
1 parent 89262cb commit 347b262
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion client/src/components/composables/media-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ export class MediaPlayerV2 {
}
return this.player.value.pause();
}
getPosition(): number {
getPosition(): number | Promise<number> {
// vimeo video player returns a promise, so we need to handle that
if (!this.checkForPlayer(this.player.value)) {
return 0;
}
Expand Down
7 changes: 6 additions & 1 deletion client/src/views/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,12 @@ export default defineComponent({
}
const currentTime = player.getPosition();
if (Math.abs(newPosition - currentTime) > 1 && !mediaPlaybackBlocked.value) {
const diff = Math.abs(newPosition - (await currentTime));
if (isNaN(diff)) {
console.error("player diff is NaN, this is a bug", newPosition, currentTime);
return;
}
if (diff > 1 && !mediaPlaybackBlocked.value) {
player.setPosition(newPosition);
}
});
Expand Down

0 comments on commit 347b262

Please sign in to comment.