5858 < h1 > Intel< sup > ®</ sup > Collaboration Suite for WebRTC</ h1 >
5959 < h2 > P2P Sample</ h2 >
6060 < div id ="description ">
61- < p > This sample works with the latest Chrome and FireFox .</ p >
61+ < p > This sample works with the latest Chrome and Firefox .</ p >
6262 </ div >
6363 < div id ="control ">
6464 < p >
@@ -73,6 +73,7 @@ <h2>P2P Sample</h2>
7373 < p >
7474 < button id ="target-video-publish "> Share Camera</ button >
7575 < button id ="target-video-unpublish "> Stop Camera Sharing</ button >
76+ < button id ="target-peerconnection-stop "> Stop Conversation</ button >
7677 < button id ="target-screen "> Share Screen</ button >
7778 </ p >
7879 </ div >
@@ -128,6 +129,7 @@ <h2>ScreenView</h2>
128129 } , signaling ) ;
129130 var localStream ;
130131 var localScreen ;
132+ var screenStream ;
131133
132134 var getTargetId = function ( ) {
133135 return $ ( '#remote-uid' ) . val ( ) ;
@@ -156,9 +158,9 @@ <h2>ScreenView</h2>
156158 let mediaStream ;
157159 Owt . Base . MediaStreamFactory . createMediaStream ( config ) . then ( stream => {
158160 mediaStream = stream ;
159- ScreenStream = new Owt . Base . LocalStream ( mediaStream , new Owt . Base . StreamSourceInfo ( 'screen-cast' , 'screen-cast' ) ) ;
160- $ ( '#local' ) . children ( 'video' ) . get ( 0 ) . srcObject = ScreenStream . mediaStream ;
161- p2p . publish ( getTargetId ( ) , ScreenStream ) . then ( publication => {
161+ screenStream = new Owt . Base . LocalStream ( mediaStream , new Owt . Base . StreamSourceInfo ( 'screen-cast' , 'screen-cast' ) ) ;
162+ $ ( '#local' ) . children ( 'video' ) . get ( 0 ) . srcObject = screenStream . mediaStream ;
163+ p2p . publish ( getTargetId ( ) , screenStream ) . then ( publication => {
162164 publicationForScreen = publication ;
163165 } ) , error => {
164166 console . log ( 'Failed to share screen.' ) ;
@@ -206,8 +208,8 @@ <h2>ScreenView</h2>
206208 }
207209 } ) ;
208210
209- $ ( '#target-disconnect ' ) . click ( function ( ) {
210- p2p . stop ( $ ( '#target -uid' ) . val ( ) ) ; // Stop chat
211+ $ ( '#target-peerconnection-stop ' ) . click ( function ( ) {
212+ p2p . stop ( $ ( '#remote -uid' ) . val ( ) ) ; // Stop conversation
211213 } ) ;
212214
213215 $ ( '#login' ) . click ( function ( ) {
@@ -252,7 +254,7 @@ <h2>ScreenView</h2>
252254 } ) ;
253255
254256 window . onbeforeunload = function ( ) {
255- p2p . stop ( $ ( '#target -uid' ) . val ( ) ) ;
257+ p2p . stop ( $ ( '#remote -uid' ) . val ( ) ) ;
256258 }
257259 </ script >
258260</ body >
0 commit comments