mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: add new StreamPropertyChanged for audioTrack and videoTrack
parent
48f20ec64f
commit
0e9ae092e5
|
@ -717,9 +717,10 @@ export class OpenVidu {
|
|||
/**
|
||||
* @hidden
|
||||
*/
|
||||
sendTrackChangedEvent(publisher: Publisher, reason: string, oldLabel: string, newLabel: string, propertyType: string) {
|
||||
sendTrackChangedEvent(publisher: Publisher, oldLabel: string, newLabel: string, propertyType: string) {
|
||||
const oldValue = { label: oldLabel };
|
||||
const newValue = { label: newLabel };
|
||||
const reason = 'trackReplaced';
|
||||
|
||||
if (publisher.stream.isLocalStreamPublished) {
|
||||
this.sendRequest(
|
||||
|
@ -727,7 +728,7 @@ export class OpenVidu {
|
|||
{
|
||||
streamId: publisher.stream.streamId,
|
||||
property: propertyType,
|
||||
newValue: JSON.stringify({ newLabel }),
|
||||
newValue: newValue,
|
||||
reason
|
||||
},
|
||||
(error, response) => {
|
||||
|
|
|
@ -811,12 +811,12 @@ export class Publisher extends StreamManager {
|
|||
};
|
||||
if (track.kind === 'video' && updateLastConstraints) {
|
||||
this.openvidu.sendNewVideoDimensionsIfRequired(this, 'trackReplaced', 50, 30);
|
||||
this.openvidu.sendTrackChangedEvent(this, 'trackReplaced', trackInfo.oldLabel, trackInfo.newLabel, 'videoActive');
|
||||
this.openvidu.sendTrackChangedEvent(this, trackInfo.oldLabel, trackInfo.newLabel, 'videoTrack');
|
||||
if (this.stream.isLocalStreamPublished) {
|
||||
this.session.sendVideoData(this.stream.streamManager, 5, true, 5);
|
||||
}
|
||||
} else if (track.kind === 'audio' && updateLastConstraints) {
|
||||
this.openvidu.sendTrackChangedEvent(this, 'trackReplaced', trackInfo.oldLabel, trackInfo.newLabel, 'audioActive');
|
||||
this.openvidu.sendTrackChangedEvent(this, trackInfo.oldLabel, trackInfo.newLabel, 'audioTrack');
|
||||
}
|
||||
if (track.kind === 'audio') {
|
||||
this.stream.disableHarkSpeakingEvent(false);
|
||||
|
|
|
@ -649,7 +649,7 @@ export class Session extends EventDispatcher {
|
|||
* when speech is detected in its audio track.
|
||||
*
|
||||
* @param stream - The Stream for which you want to start receiving [[SpeechToTextEvent]].
|
||||
* @þaram lang - The language of the Stream's audio track. It must be a valid [BCP-47](https://tools.ietf.org/html/bcp47) language tag like "en-US" or "es-ES".
|
||||
* @param lang - The language of the Stream's audio track. It must be a valid [BCP-47](https://tools.ietf.org/html/bcp47) language tag like "en-US" or "es-ES".
|
||||
*
|
||||
* @returns A Promise (to which you can optionally subscribe to) that is resolved if the speech-to-text subscription
|
||||
* was successful and rejected with an Error object if not.
|
||||
|
@ -990,6 +990,12 @@ export class Session extends EventDispatcher {
|
|||
event.newValue = event.newValue === 'true';
|
||||
stream.videoActive = event.newValue;
|
||||
break;
|
||||
case 'videoTrack':
|
||||
event.newValue = JSON.parse(event.newValue);
|
||||
break;
|
||||
case 'audioTrack':
|
||||
event.newValue = JSON.parse(event.newValue);
|
||||
break;
|
||||
case 'videoDimensions':
|
||||
oldValue = stream.videoDimensions;
|
||||
event.newValue = JSON.parse(JSON.parse(event.newValue));
|
||||
|
|
|
@ -30,7 +30,7 @@ export class StreamPropertyChangedEvent extends Event {
|
|||
stream: Stream;
|
||||
|
||||
/**
|
||||
* The property of the stream that changed. This value is either `"videoActive"`, `"audioActive"`, `"videoDimensions"` or `"filter"`
|
||||
* The property of the stream that changed. This value is either `"videoActive"`, `"audioActive"`, `"videoTrack"`, `"audioTrack"`, `"videoDimensions"` or `"filter"`
|
||||
*/
|
||||
changedProperty: string;
|
||||
|
||||
|
@ -38,6 +38,8 @@ export class StreamPropertyChangedEvent extends Event {
|
|||
* Cause of the change on the stream's property:
|
||||
* - For `videoActive`: `"publishVideo"`
|
||||
* - For `audioActive`: `"publishAudio"`
|
||||
* - For `videoTrack`: `"trackReplaced"`
|
||||
* - For `audioTrack`: `"trackReplaced"`
|
||||
* - For `videoDimensions`: `"deviceRotated"`, `"screenResized"` or `"trackReplaced"`
|
||||
* - For `filter`: `"applyFilter"`, `"execFilterMethod"` or `"removeFilter"`
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue