File tree Expand file tree Collapse file tree 8 files changed +76
-13
lines changed
Expand file tree Collapse file tree 8 files changed +76
-13
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,9 @@ export default class RoomClient
252252
253253 async join ( )
254254 {
255+ store . dispatch (
256+ stateActions . setMediasoupClientVersion ( mediasoupClient . version ) ) ;
257+
255258 const protooTransport = new protooClient . WebSocketTransport ( this . _protooUrl ) ;
256259
257260 this . _protoo = new protooClient . Peer ( protooTransport ) ;
@@ -603,6 +606,16 @@ export default class RoomClient
603606
604607 switch ( notification . method )
605608 {
609+ case 'mediasoup-version' :
610+ {
611+ const { version } = notification . data ;
612+
613+ store . dispatch (
614+ stateActions . setMediasoupVersion ( version ) ) ;
615+
616+ break ;
617+ }
618+
606619 case 'producerScore' :
607620 {
608621 const { producerId, score } = notification . data ;
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ class Room extends React.Component
2727 onRoomLinkCopy
2828 } = this . props ;
2929
30+ const mediasoupClientVersion = room . mediasoupClientVersion === '__MEDIASOUP_CLIENT_VERSION__'
31+ ? 'dev'
32+ : room . mediasoupClientVersion ;
33+
3034 return (
3135 < Appear duration = { 300 } >
3236 < div data-component = 'Room' >
@@ -37,8 +41,10 @@ class Room extends React.Component
3741 < p className = { classnames ( 'text' , room . state ) } > { room . state } </ p >
3842 </ div >
3943
40- < div className = 'mediasoup-client-handler-name' >
41- < p className = 'text' > < span className = 'label' > handler: </ span > { room . mediasoupClientHandler } </ p >
44+ < div className = 'info' >
45+ < p className = 'text' > < span className = 'label' > server: </ span > { room . mediasoupVersion } </ p >
46+ < p className = 'text' > < span className = 'label' > client: </ span > { mediasoupClientVersion } </ p >
47+ < p className = 'text' > < span className = 'label' > handler: </ span > { room . mediasoupClientHandler } </ p >
4248 </ div >
4349
4450 < div className = 'room-link-wrapper' >
Original file line number Diff line number Diff line change @@ -141,10 +141,14 @@ async function run()
141141 case 'throttleSecret' :
142142 case 'e2eKey' :
143143 case 'consumerReplicas' :
144+ {
144145 break ;
146+ }
145147
146148 default :
149+ {
147150 delete roomUrlParser . query [ key ] ;
151+ }
148152 }
149153 }
150154 delete roomUrlParser . hash ;
Original file line number Diff line number Diff line change 55 room :
66 {
77 url : ' https://demo.mediasoup.org/?roomId=d0el8y34' ,
8+ mediasoupVersion : null ,
9+ mediasoupClientVersion : null
810 state : ' connected' , // new/connecting/connected/closed
911 activeSpeakerId : ' alice' ,
1012 statsPeerId : null ,
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ const initialState =
22{
33 url : null ,
44 state : 'new' , // new/connecting/connected/disconnected/closed,
5+ mediasoupVersion : null ,
6+ mediasoupClientVersion : null ,
57 mediasoupClientHandler : undefined ,
68 activeSpeakerId : null ,
79 statsPeerId : null ,
@@ -36,6 +38,20 @@ const room = (state = initialState, action) =>
3638 return { ...state , mediasoupClientHandler } ;
3739 }
3840
41+ case 'SET_MEDIASOUP_VERSION' :
42+ {
43+ const { version } = action . payload ;
44+
45+ return { ...state , mediasoupVersion : version } ;
46+ }
47+
48+ case 'SET_MEDIASOUP_CLIENT_VERSION' :
49+ {
50+ const { version } = action . payload ;
51+
52+ return { ...state , mediasoupClientVersion : version } ;
53+ }
54+
3955 case 'SET_ROOM_ACTIVE_SPEAKER' :
4056 {
4157 const { peerId } = action . payload ;
Original file line number Diff line number Diff line change @@ -22,6 +22,22 @@ export const setRoomMediasoupClientHandler = (mediasoupClientHandler) =>
2222 } ;
2323} ;
2424
25+ export const setMediasoupVersion = ( version ) =>
26+ {
27+ return {
28+ type : 'SET_MEDIASOUP_VERSION' ,
29+ payload : { version }
30+ } ;
31+ } ;
32+
33+ export const setMediasoupClientVersion = ( version ) =>
34+ {
35+ return {
36+ type : 'SET_MEDIASOUP_CLIENT_VERSION' ,
37+ payload : { version }
38+ } ;
39+ } ;
40+
2541export const setRoomActiveSpeaker = ( peerId ) =>
2642{
2743 return {
Original file line number Diff line number Diff line change 8888 }
8989 }
9090
91- > .mediasoup-client-handler-name {
91+ > .info {
9292 position : fixed ;
9393 z-index : 100 ;
94- display : flex ;
95- flex-direction : row ;
96- justify-content : center ;
97- align-items : center ;
98- border-radius : 25px ;
99- background-color : $COLOR_BG_1 ;
10094
10195 + desktop () {
10296 top : 55px ;
10397 left : 20px ;
104- height : 18px ;
10598 width : 124px ;
10699 }
107100
108101 + mobile () {
109102 top : 40px ;
110- left : 10px ;
111103 height : 18px ;
112104 width : 110px ;
113105 }
114106
115- > .text {
107+ > p .text {
108+ height : 18px ;
109+ left : 10px ;
110+ display : flex ;
111+ flex-direction : row ;
112+ justify-content : center ;
113+ align-items : center ;
116114 flex : 100 0 auto ;
117115 user-select : none ;
118116 pointer-events : none ;
119117 text-align : center ;
120118 font-family : 'Roboto' ;
121119 font-weight : 400 ;
122120 color : rgba (#f f f , 0.75 );
121+ border-radius : 25px ;
122+ background-color : $COLOR_BG_1 ;
123+ margin-bottom : 2px ;
123124
124125 + desktop () {
125- font-size : 10 px ;
126+ font-size : 11 px ;
126127 }
127128
128129 + mobile () {
Original file line number Diff line number Diff line change 11const EventEmitter = require ( 'events' ) . EventEmitter ;
2+ const mediasoup = require ( 'mediasoup' ) ;
23const protoo = require ( 'protoo-server' ) ;
34// const rtp = require('rtp.js');
45const throttle = require ( '@sitespeed.io/throttle' ) ;
@@ -224,6 +225,10 @@ class Room extends EventEmitter
224225 logger . error ( 'protooRoom.createPeer() failed:%o' , error ) ;
225226 }
226227
228+ // Notify mediasoup version to the peer.
229+ peer . notify ( 'mediasoup-version' , { version : mediasoup . version } )
230+ . catch ( ( ) => { } ) ;
231+
227232 // Use the peer.data object to store mediasoup related objects.
228233
229234 // Not joined after a custom protoo 'join' request is later received.
You can’t perform that action at this time.
0 commit comments