Skip to content

Commit

Permalink
Force a browser repaint (#541)
Browse files Browse the repository at this point in the history
* force a browser repaint on layout.changed

* changeset

* Fix for making Chrome render the video properly (#544)

* replace fix for making Chrome render the video properly

* change how we show/hide the video layer

Co-authored-by: Francisco Ramini <framini@gmail.com>
  • Loading branch information
edolix and framini authored May 24, 2022
1 parent 52d77fd commit 4ad0935
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-actors-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@signalwire/js': patch
---

Try to force a browser repaint to move the local video overlay in the correct position
4 changes: 2 additions & 2 deletions packages/js/src/features/mediaElements/mediaElementsSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ export const makeVideoElementSaga = ({
if (!this.domElement) {
return getLogger().warn('Missing localOverlay to hide')
}
this.domElement.style.display = 'none'
this.domElement.style.opacity = '0'
},
show() {
if (!this.domElement) {
return getLogger().warn('Missing localOverlay to show')
}
this.domElement.style.display = 'block'
this.domElement.style.opacity = '1'
},
}

Expand Down
2 changes: 1 addition & 1 deletion packages/js/src/utils/videoElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const makeLayoutChangedHandler =
* Show myLayer only if the localStream has a valid video track
*/
if (localStream.getVideoTracks().length > 0) {
myLayer.style.display = 'block'
myLayer.style.opacity = '1'
}
myLayer.style.top = top
myLayer.style.left = left
Expand Down

0 comments on commit 4ad0935

Please sign in to comment.