@@ -261,6 +261,8 @@ var app = new Vue({
261261 console . log ( "scaleLocal changed from " + oldValue + " to " + newValue ) ;
262262 if ( oldValue !== null && newValue !== oldValue ) {
263263 if ( newValue === true ) {
264+ webrtc . element . style . width = '' ;
265+ webrtc . element . style . height = '' ;
264266 webrtc . element . setAttribute ( "class" , "video scale" ) ;
265267 } else {
266268 webrtc . element . setAttribute ( "class" , "video" ) ;
@@ -471,7 +473,7 @@ webrtc.input.onfullscreenhotkey = () => {
471473
472474webrtc . input . onresizeend = ( ) => {
473475 app . windowResolution = webrtc . input . getWindowResolution ( ) ;
474- var newRes = parseInt ( app . windowResolution [ 0 ] / window . devicePixelRatio ) + "x" + parseInt ( app . windowResolution [ 1 ] / window . devicePixelRatio ) ;
476+ var newRes = parseInt ( app . windowResolution [ 0 ] ) + "x" + parseInt ( app . windowResolution [ 1 ] ) ;
475477 console . log ( `Window size changed: ${ app . windowResolution [ 0 ] } x${ app . windowResolution [ 1 ] } , scaled to: ${ newRes } ` ) ;
476478 webrtc . sendDataChannelMessage ( "r," + newRes ) ;
477479 webrtc . sendDataChannelMessage ( "s," + window . devicePixelRatio ) ;
@@ -592,13 +594,15 @@ webrtc.onsystemaction = (action) => {
592594 app . scaleLocal = true ;
593595 }
594596 }
595-
596- // Send initial window size.
597+ } else if ( action . startsWith ( "resolution" ) ) {
598+ // Sent when remote resizing is enabled.
599+ // Match the CSS of the video element to the remote resolution.
600+ var remote_res = action . split ( "," ) [ 1 ] ;
601+ console . log ( "received remote resolution of: " + remote_res ) ;
597602 if ( app . resizeRemote === true ) {
598- app . windowResolution = webrtc . input . getWindowResolution ( ) ;
599- var newRes = parseInt ( app . windowResolution [ 0 ] / window . devicePixelRatio ) + "x" + parseInt ( app . windowResolution [ 1 ] / window . devicePixelRatio ) ;
600- console . log ( `Initial window resolution: ${ app . windowResolution [ 0 ] } x${ app . windowResolution [ 1 ] } , scaled to: ${ newRes } ` ) ;
601- webrtc . sendDataChannelMessage ( "r," + newRes ) ;
603+ var toks = remote_res . split ( "x" ) ;
604+ webrtc . element . style . width = toks [ 0 ] / window . devicePixelRatio + 'px' ;
605+ webrtc . element . style . height = toks [ 1 ] / window . devicePixelRatio + 'px' ;
602606 }
603607 } else if ( action . startsWith ( "local_scaling" ) ) {
604608 // Local scaling default pushed from server
@@ -685,6 +689,11 @@ fetch("/turn/")
685689 // get initial local resolution
686690 app . windowResolution = webrtc . input . getWindowResolution ( ) ;
687691
692+ if ( app . scaleLocal === false ) {
693+ webrtc . element . style . width = app . windowResolution [ 0 ] / window . devicePixelRatio + 'px' ;
694+ webrtc . element . style . height = app . windowResolution [ 1 ] / window . devicePixelRatio + 'px' ;
695+ }
696+
688697 if ( config . iceServers . length > 1 ) {
689698 app . debugEntries . push ( applyTimestamp ( "[app] using TURN servers: " + config . iceServers [ 1 ] . urls . join ( ", " ) ) ) ;
690699 } else {
0 commit comments