mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: Publisher publishAudio and publishVideo may be called without a Session
parent
5f1565cac0
commit
2a85971dfa
|
@ -90,6 +90,8 @@ export class Publisher extends StreamManager {
|
||||||
*
|
*
|
||||||
* #### Events dispatched
|
* #### Events dispatched
|
||||||
*
|
*
|
||||||
|
* > _Only if `Session.publish(Publisher)` has been called for this Publisher_
|
||||||
|
*
|
||||||
* The [[Session]] object of the local participant will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"audioActive"` and `reason` set to `"publishAudio"`
|
* The [[Session]] object of the local participant will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"audioActive"` and `reason` set to `"publishAudio"`
|
||||||
* The [[Publisher]] object of the local participant will also dispatch the exact same event
|
* The [[Publisher]] object of the local participant will also dispatch the exact same event
|
||||||
*
|
*
|
||||||
|
@ -105,6 +107,7 @@ export class Publisher extends StreamManager {
|
||||||
this.stream.getMediaStream().getAudioTracks().forEach((track) => {
|
this.stream.getMediaStream().getAudioTracks().forEach((track) => {
|
||||||
track.enabled = value;
|
track.enabled = value;
|
||||||
});
|
});
|
||||||
|
if (!!this.session && !!this.stream.streamId) {
|
||||||
this.session.openvidu.sendRequest(
|
this.session.openvidu.sendRequest(
|
||||||
'streamPropertyChanged',
|
'streamPropertyChanged',
|
||||||
{
|
{
|
||||||
|
@ -121,6 +124,7 @@ export class Publisher extends StreamManager {
|
||||||
this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this, this.stream, 'audioActive', value, !value, 'publishAudio')]);
|
this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this, this.stream, 'audioActive', value, !value, 'publishAudio')]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
this.stream.audioActive = value;
|
this.stream.audioActive = value;
|
||||||
console.info("'Publisher' has " + (value ? 'published' : 'unpublished') + ' its audio stream');
|
console.info("'Publisher' has " + (value ? 'published' : 'unpublished') + ' its audio stream');
|
||||||
}
|
}
|
||||||
|
@ -132,6 +136,8 @@ export class Publisher extends StreamManager {
|
||||||
*
|
*
|
||||||
* #### Events dispatched
|
* #### Events dispatched
|
||||||
*
|
*
|
||||||
|
* > _Only if `Session.publish(Publisher)` has been called for this Publisher_
|
||||||
|
*
|
||||||
* The [[Session]] object of the local participant will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"videoActive"` and `reason` set to `"publishVideo"`
|
* The [[Session]] object of the local participant will dispatch a `streamPropertyChanged` event with `changedProperty` set to `"videoActive"` and `reason` set to `"publishVideo"`
|
||||||
* The [[Publisher]] object of the local participant will also dispatch the exact same event
|
* The [[Publisher]] object of the local participant will also dispatch the exact same event
|
||||||
*
|
*
|
||||||
|
@ -147,6 +153,7 @@ export class Publisher extends StreamManager {
|
||||||
this.stream.getMediaStream().getVideoTracks().forEach((track) => {
|
this.stream.getMediaStream().getVideoTracks().forEach((track) => {
|
||||||
track.enabled = value;
|
track.enabled = value;
|
||||||
});
|
});
|
||||||
|
if (!!this.session && !!this.stream.streamId) {
|
||||||
this.session.openvidu.sendRequest(
|
this.session.openvidu.sendRequest(
|
||||||
'streamPropertyChanged',
|
'streamPropertyChanged',
|
||||||
{
|
{
|
||||||
|
@ -163,6 +170,7 @@ export class Publisher extends StreamManager {
|
||||||
this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this, this.stream, 'videoActive', value, !value, 'publishVideo')]);
|
this.emitEvent('streamPropertyChanged', [new StreamPropertyChangedEvent(this, this.stream, 'videoActive', value, !value, 'publishVideo')]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
this.stream.videoActive = value;
|
this.stream.videoActive = value;
|
||||||
console.info("'Publisher' has " + (value ? 'published' : 'unpublished') + ' its video stream');
|
console.info("'Publisher' has " + (value ? 'published' : 'unpublished') + ' its video stream');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue