Skip to content

Commit

Permalink
fix: make sure the video size is send when video is added
Browse files Browse the repository at this point in the history
  • Loading branch information
tyohan committed Sep 9, 2024
1 parent 0bdafd1 commit 20ea6fc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/room/observer/video-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ export class VideoObserver {
observe(videoElement) {
this.#intersectionObserver.observe(videoElement)
this.#resizeObserver.observe(videoElement)

// report the initial size
if (!(videoElement.srcObject instanceof MediaStream)) return

const videoTracks = videoElement.srcObject.getVideoTracks()
if (videoTracks?.length > 0) {
const trackid = videoTracks[0].id
const width = videoElement.offsetWidth
const height = videoElement.offsetHeight
this.#onVideoSizeChanged(trackid, width, height)
}
}

/**
Expand Down

0 comments on commit 20ea6fc

Please sign in to comment.