@ -1,4 +1,3 @@
import Vue from 'vue'
import Vue from 'vue'
import {
import {
RequestState
RequestState
@ -26,7 +25,7 @@ export default {
leaveState : RequestState . initiated ,
leaveState : RequestState . initiated ,
leaveError : null ,
leaveError : null ,
participants : [ ] ,
participants : [ ] ,
remoteMediaStreams : []
remoteMediaStreams : {}
} ,
} ,
getters : {
getters : {
username ( state , getters , rootState , rootGetters ) {
username ( state , getters , rootState , rootGetters ) {
@ -88,9 +87,9 @@ export default {
remoteParticipant : ( ) => ( participantId ) => {
remoteParticipant : ( ) => ( participantId ) => {
return Vue . $conference . getRemoteParticipant ( participantId ) ;
return Vue . $conference . getRemoteParticipant ( participantId ) ;
} ,
} ,
remoteMediaStream : ( state ) => ( participantId ) => {
remoteMediaStream : ( ) => ( participantId ) => {
if ( state . remoteMediaStreams . includes ( participantId ) ) {
const participant = Vue . $conference . getRemoteParticipant ( participantId ) ;
const participant = Vue . $conference . getRemoteParticipant ( participantId ) ;
if ( participant !== null ) {
return participant . mediaStream ? participant . mediaStream . getStream ( ) : null ;
return participant . mediaStream ? participant . mediaStream . getStream ( ) : null ;
}
}
return null ;
return null ;
@ -102,10 +101,13 @@ export default {
remoteMediaStreams ( state ) {
remoteMediaStreams ( state ) {
return state . remoteMediaStreams ;
return state . remoteMediaStreams ;
} ,
} ,
hasRemoteMediaStream : ( state ) => ( participantId ) => {
hasRemoteVideo : ( ) => ( participantId ) => {
return state . remoteMediaStreams . includes ( participantId )
const participant = Vue . $conference . getRemoteParticipant ( participantId ) ;
if ( participant !== null ) {
return participant . mediaStream ? participant . mediaStream . hasVideo ( ) : false ;
}
return false ;
}
}
} ,
} ,
mutations : {
mutations : {
enableConferencing ( state ) {
enableConferencing ( state ) {
@ -154,18 +156,10 @@ export default {
state . screenEnabled = false ;
state . screenEnabled = false ;
} ,
} ,
addRemoteMedia ( state , participantId ) {
addRemoteMedia ( state , participantId ) {
if ( state . remoteMediaStreams . includes ( participantId ) ) {
Vue . set ( state . remoteMediaStreams , participantId , participantId ) ;
state . remoteMediaStreams = state . remoteMediaStreams . filter ( ( $participant ) => {
return participantId !== $participant ;
} ) ;
}
state . remoteMediaStreams . push ( participantId ) ;
} ,
} ,
removeRemoteMedia ( state , participant ) {
removeRemoteMedia ( state , participantId ) {
state . remoteMediaStreams = state . remoteMediaStreams . filter ( ( $participant ) => {
Vue . delete ( state . remoteMediaStreams , participantId ) ;
return participant !== $participant ;
} ) ;
} ,
} ,
joinRequesting ( state ) {
joinRequesting ( state ) {
state . joinState = RequestState . requesting ;
state . joinState = RequestState . requesting ;
@ -201,12 +195,14 @@ export default {
return participant . getId ( ) !== $participant ;
return participant . getId ( ) !== $participant ;
} ) ;
} ) ;
}
}
state . participants . push ( participant . getId ( ) )
state . participants . push ( participant . getId ( ) ) ;
} ,
} ,
participantLeft ( state , participant ) {
participantLeft ( state , participant ) {
state . participants = state . participants . filter ( ( $participant ) => {
state . participants = state . participants . filter ( ( $participant ) => {
return participant . getId ( ) !== $participant ;
return participant . getId ( ) !== $participant ;
} ) ;
} ) ;
Vue . delete ( state . remoteMediaStreams , participant . getId ( ) ) ;
}
}
} ,
} ,
actions : {
actions : {