зеркало из https://github.com/nextcloud/spreed.git
Add getters to check if media is allowed or disallowed
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Родитель
c91ebaae58
Коммит
a7a9e8368a
|
@ -68,6 +68,14 @@ export default class MediaDevicesSource extends TrackSource {
|
|||
this._active = false
|
||||
}
|
||||
|
||||
isAudioAllowed() {
|
||||
return this._audioAllowed
|
||||
}
|
||||
|
||||
isVideoAllowed() {
|
||||
return this._videoAllowed
|
||||
}
|
||||
|
||||
setAudioAllowed(audioAllowed) {
|
||||
if (this._audioAllowed === audioAllowed) {
|
||||
return
|
||||
|
|
|
@ -161,6 +161,27 @@ describe('MediaDevicesSource', () => {
|
|||
jest.restoreAllMocks()
|
||||
})
|
||||
|
||||
describe('get allowed state', () => {
|
||||
test('audio and video are allowed by default', () => {
|
||||
expect(mediaDevicesSource.isAudioAllowed()).toBe(true)
|
||||
expect(mediaDevicesSource.isVideoAllowed()).toBe(true)
|
||||
})
|
||||
|
||||
test('after modifying the audio state', () => {
|
||||
mediaDevicesSource.setAudioAllowed(false)
|
||||
|
||||
expect(mediaDevicesSource.isAudioAllowed()).toBe(false)
|
||||
expect(mediaDevicesSource.isVideoAllowed()).toBe(true)
|
||||
})
|
||||
|
||||
test('after modifying the video state', () => {
|
||||
mediaDevicesSource.setVideoAllowed(false)
|
||||
|
||||
expect(mediaDevicesSource.isAudioAllowed()).toBe(true)
|
||||
expect(mediaDevicesSource.isVideoAllowed()).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('start', () => {
|
||||
|
||||
/**
|
||||
|
|
|
@ -288,6 +288,10 @@ LocalMedia.prototype.stopScreenShare = function() {
|
|||
}
|
||||
|
||||
// Audio controls
|
||||
LocalMedia.prototype.isAudioAllowed = function() {
|
||||
return this._mediaDevicesSource.isAudioAllowed()
|
||||
}
|
||||
|
||||
LocalMedia.prototype.disallowAudio = function() {
|
||||
this._mediaDevicesSource.setAudioAllowed(false)
|
||||
this.emit('audioDisallowed')
|
||||
|
@ -309,6 +313,10 @@ LocalMedia.prototype.unmute = function() {
|
|||
}
|
||||
|
||||
// Video controls
|
||||
LocalMedia.prototype.isVideoAllowed = function() {
|
||||
return this._mediaDevicesSource.isVideoAllowed()
|
||||
}
|
||||
|
||||
LocalMedia.prototype.disallowVideo = function() {
|
||||
this._mediaDevicesSource.setVideoAllowed(false)
|
||||
this.emit('videoDisallowed')
|
||||
|
|
Загрузка…
Ссылка в новой задаче