Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/__mocks__/attachmediastream.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Basic "attachmediastream" implementation without using "webrtc-adapter", as
* "browserDetails" is null in unit tests.
*
* @param {MediaStream} stream the stream to attach
* @param {HTMLElement} element the element to attach the stream to
* @param {object} options ignored
*/
export default function(stream, element, options) {
if (!element) {
element = document.createElement(options.audio ? 'audio' : 'video')
}

element.srcObject = stream

return element
}
12 changes: 3 additions & 9 deletions src/components/CallView/CallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ import { loadState } from '@nextcloud/initial-state'
import Grid from './Grid/Grid'
import { SIMULCAST } from '../../constants'
import { localMediaModel, localCallParticipantModel, callParticipantCollection } from '../../utils/webrtc/index'
import RemoteVideoBlocker from '../../utils/webrtc/RemoteVideoBlocker'
import { fetchPeers } from '../../services/callsService'
import { showMessage } from '@nextcloud/dialogs'
import EmptyCallView from './shared/EmptyCallView'
Expand Down Expand Up @@ -212,7 +213,7 @@ export default {
callParticipantModelsWithVideo() {
return this.callParticipantModels.filter(callParticipantModel => {
return callParticipantModel.attributes.videoAvailable
&& this.sharedDatas[callParticipantModel.attributes.peerId].videoEnabled
&& this.sharedDatas[callParticipantModel.attributes.peerId].remoteVideoBlocker.isVideoEnabled()
&& (typeof callParticipantModel.attributes.stream === 'object')
})
},
Expand Down Expand Up @@ -404,15 +405,13 @@ export default {

callParticipantCollection.on('remove', this._lowerHandWhenParticipantLeaves)

subscribe('talk:video:toggled', this.handleToggleVideo)
subscribe('switch-screen-to-id', this._switchScreenToId)
},
beforeDestroy() {
EventBus.$off('refresh-peer-list', this.debounceFetchPeers)

callParticipantCollection.off('remove', this._lowerHandWhenParticipantLeaves)

unsubscribe('talk:video:toggled', this.handleToggleVideo)
unsubscribe('switch-screen-to-id', this._switchScreenToId)
},
methods: {
Expand Down Expand Up @@ -454,7 +453,7 @@ export default {
addedModels.forEach(addedModel => {
const sharedData = {
promoted: false,
videoEnabled: true,
remoteVideoBlocker: new RemoteVideoBlocker(addedModel),
screenVisible: false,
}

Expand Down Expand Up @@ -646,11 +645,6 @@ export default {
}
}, 1500),

// Toggles videos on and off
handleToggleVideo({ peerId, value }) {
this.sharedDatas[peerId].videoEnabled = value
},

adjustSimulcastQuality() {
this.callParticipantModels.forEach(callParticipantModel => {
this.adjustSimulcastQualityForParticipant(callParticipantModel)
Expand Down
6 changes: 5 additions & 1 deletion src/components/CallView/Grid/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,11 @@ export default {

placeholderSharedData() {
return {
videoEnabled: true,
videoEnabled: {
isVideoEnabled() {
return true
},
},
screenVisible: false,
}
},
Expand Down
Loading