mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: add TypeOfVideo
parent
f158119d68
commit
4fe0a4fda2
|
@ -29,6 +29,7 @@ import { PublisherSpeakingEvent } from '../OpenViduInternal/Events/PublisherSpea
|
||||||
import { StreamManagerEvent } from '../OpenViduInternal/Events/StreamManagerEvent';
|
import { StreamManagerEvent } from '../OpenViduInternal/Events/StreamManagerEvent';
|
||||||
import { StreamPropertyChangedEvent } from '../OpenViduInternal/Events/StreamPropertyChangedEvent';
|
import { StreamPropertyChangedEvent } from '../OpenViduInternal/Events/StreamPropertyChangedEvent';
|
||||||
import { OpenViduError, OpenViduErrorName } from '../OpenViduInternal/Enums/OpenViduError';
|
import { OpenViduError, OpenViduErrorName } from '../OpenViduInternal/Enums/OpenViduError';
|
||||||
|
import { TypeOfVideo } from '../OpenViduInternal/Enums/TypeOfVideo';
|
||||||
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
||||||
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ export class Stream {
|
||||||
*
|
*
|
||||||
* If [[hasVideo]] is false, this property is undefined
|
* If [[hasVideo]] is false, this property is undefined
|
||||||
*/
|
*/
|
||||||
typeOfVideo?: string;
|
typeOfVideo?: TypeOfVideo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StreamManager object ([[Publisher]] or [[Subscriber]]) in charge of displaying this stream in the DOM
|
* StreamManager object ([[Publisher]] or [[Subscriber]]) in charge of displaying this stream in the DOM
|
||||||
|
@ -264,9 +265,9 @@ export class Stream {
|
||||||
this.videoActive = !!this.outboundStreamOpts.publisherProperties.publishVideo;
|
this.videoActive = !!this.outboundStreamOpts.publisherProperties.publishVideo;
|
||||||
this.frameRate = this.outboundStreamOpts.publisherProperties.frameRate;
|
this.frameRate = this.outboundStreamOpts.publisherProperties.frameRate;
|
||||||
if (typeof MediaStreamTrack !== 'undefined' && this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack) {
|
if (typeof MediaStreamTrack !== 'undefined' && this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack) {
|
||||||
this.typeOfVideo = 'CUSTOM';
|
this.typeOfVideo = TypeOfVideo.CUSTOM;
|
||||||
} else {
|
} else {
|
||||||
this.typeOfVideo = this.isSendScreen() ? 'SCREEN' : 'CAMERA';
|
this.typeOfVideo = this.isSendScreen() ? TypeOfVideo.SCREEN : TypeOfVideo.CAMERA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!!this.outboundStreamOpts.publisherProperties.filter) {
|
if (!!this.outboundStreamOpts.publisherProperties.filter) {
|
||||||
|
@ -864,9 +865,9 @@ export class Stream {
|
||||||
sdpString: sdpOfferParam
|
sdpString: sdpOfferParam
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let typeOfVideo = '';
|
let typeOfVideo;
|
||||||
if (this.isSendVideo()) {
|
if (this.isSendVideo()) {
|
||||||
typeOfVideo = (typeof MediaStreamTrack !== 'undefined' && this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack) ? 'CUSTOM' : (this.isSendScreen() ? 'SCREEN' : 'CAMERA');
|
typeOfVideo = (typeof MediaStreamTrack !== 'undefined' && this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack) ? TypeOfVideo.CUSTOM : (this.isSendScreen() ? TypeOfVideo.SCREEN : TypeOfVideo.CAMERA);
|
||||||
}
|
}
|
||||||
params = {
|
params = {
|
||||||
doLoopback: this.displayMyRemote() || false,
|
doLoopback: this.displayMyRemote() || false,
|
||||||
|
@ -928,7 +929,8 @@ export class Stream {
|
||||||
onIceConnectionStateException: (exceptionName: ExceptionEventName, message: string, data?: any) => { this.session.emitEvent('exception', [new ExceptionEvent(this.session, exceptionName, this, message, data)]) },
|
onIceConnectionStateException: (exceptionName: ExceptionEventName, message: string, data?: any) => { this.session.emitEvent('exception', [new ExceptionEvent(this.session, exceptionName, this, message, data)]) },
|
||||||
iceServers: this.getIceServersConf(),
|
iceServers: this.getIceServersConf(),
|
||||||
mediaStream: this.mediaStream,
|
mediaStream: this.mediaStream,
|
||||||
mediaServer: this.session.openvidu.mediaServer
|
mediaServer: this.session.openvidu.mediaServer,
|
||||||
|
typeOfVideo: this.typeOfVideo
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.session.openvidu.mediaServer !== 'mediasoup') {
|
if (this.session.openvidu.mediaServer !== 'mediasoup') {
|
||||||
|
@ -1092,7 +1094,8 @@ export class Stream {
|
||||||
onIceCandidate: this.connection.sendIceCandidate.bind(this.connection),
|
onIceCandidate: this.connection.sendIceCandidate.bind(this.connection),
|
||||||
onIceConnectionStateException: (exceptionName: ExceptionEventName, message: string, data?: any) => { this.session.emitEvent('exception', [new ExceptionEvent(this.session, exceptionName, this, message, data)]) },
|
onIceConnectionStateException: (exceptionName: ExceptionEventName, message: string, data?: any) => { this.session.emitEvent('exception', [new ExceptionEvent(this.session, exceptionName, this, message, data)]) },
|
||||||
iceServers: this.getIceServersConf(),
|
iceServers: this.getIceServersConf(),
|
||||||
mediaServer: this.session.openvidu.mediaServer
|
mediaServer: this.session.openvidu.mediaServer,
|
||||||
|
typeOfVideo: this.typeOfVideo
|
||||||
};
|
};
|
||||||
|
|
||||||
if (reconnect) {
|
if (reconnect) {
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2017-2022 OpenVidu (https://openvidu.io)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
export enum TypeOfVideo {
|
||||||
|
CAMERA = 'CAMERA',
|
||||||
|
SCREEN = 'SCREEN',
|
||||||
|
CUSTOM = 'CUSTOM',
|
||||||
|
IPCAM = 'IPCAM'
|
||||||
|
}
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
import { Connection } from '../../../OpenVidu/Connection';
|
import { Connection } from '../../../OpenVidu/Connection';
|
||||||
import { Filter } from '../../../OpenVidu/Filter';
|
import { Filter } from '../../../OpenVidu/Filter';
|
||||||
|
import { TypeOfVideo } from '../../Enums/TypeOfVideo';
|
||||||
|
|
||||||
export interface InboundStreamOptions {
|
export interface InboundStreamOptions {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -26,7 +27,7 @@ export interface InboundStreamOptions {
|
||||||
hasVideo: boolean;
|
hasVideo: boolean;
|
||||||
audioActive: boolean;
|
audioActive: boolean;
|
||||||
videoActive: boolean;
|
videoActive: boolean;
|
||||||
typeOfVideo: string;
|
typeOfVideo: TypeOfVideo;
|
||||||
frameRate: number;
|
frameRate: number;
|
||||||
videoDimensions: { width: number, height: number };
|
videoDimensions: { width: number, height: number };
|
||||||
filter?: Filter;
|
filter?: Filter;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Filter } from '../../../OpenVidu/Filter';
|
import { Filter } from '../../../OpenVidu/Filter';
|
||||||
|
import { TypeOfVideo } from '../../Enums/TypeOfVideo';
|
||||||
|
|
||||||
export interface StreamOptionsServer {
|
export interface StreamOptionsServer {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -24,7 +25,7 @@ export interface StreamOptionsServer {
|
||||||
hasVideo: boolean;
|
hasVideo: boolean;
|
||||||
audioActive: boolean;
|
audioActive: boolean;
|
||||||
videoActive: boolean;
|
videoActive: boolean;
|
||||||
typeOfVideo: string;
|
typeOfVideo: TypeOfVideo;
|
||||||
frameRate: number;
|
frameRate: number;
|
||||||
videoDimensions: string;
|
videoDimensions: string;
|
||||||
filter: Filter;
|
filter: Filter;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
import freeice = require('freeice');
|
import freeice = require('freeice');
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import { TypeOfVideo } from '../Enums/TypeOfVideo';
|
||||||
import { ExceptionEventName } from '../Events/ExceptionEvent';
|
import { ExceptionEventName } from '../Events/ExceptionEvent';
|
||||||
import { OpenViduLogger } from '../Logger/OpenViduLogger';
|
import { OpenViduLogger } from '../Logger/OpenViduLogger';
|
||||||
import { PlatformUtils } from '../Utils/Platform';
|
import { PlatformUtils } from '../Utils/Platform';
|
||||||
|
@ -104,6 +105,7 @@ export interface WebRtcPeerConfiguration {
|
||||||
mediaStream?: MediaStream | null;
|
mediaStream?: MediaStream | null;
|
||||||
mode?: 'sendonly' | 'recvonly' | 'sendrecv';
|
mode?: 'sendonly' | 'recvonly' | 'sendrecv';
|
||||||
id?: string;
|
id?: string;
|
||||||
|
typeOfVideo: TypeOfVideo | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WebRtcPeer {
|
export class WebRtcPeer {
|
||||||
|
@ -133,6 +135,7 @@ export class WebRtcPeer {
|
||||||
: null,
|
: null,
|
||||||
mode: !!configuration.mode ? configuration.mode : "sendrecv",
|
mode: !!configuration.mode ? configuration.mode : "sendrecv",
|
||||||
id: !!configuration.id ? configuration.id : this.generateUniqueId(),
|
id: !!configuration.id ? configuration.id : this.generateUniqueId(),
|
||||||
|
typeOfVideo: configuration.typeOfVideo
|
||||||
};
|
};
|
||||||
|
|
||||||
this.pc = new RTCPeerConnection({ iceServers: this.configuration.iceServers });
|
this.pc = new RTCPeerConnection({ iceServers: this.configuration.iceServers });
|
||||||
|
|
|
@ -12,6 +12,7 @@ export { Filter } from './OpenVidu/Filter';
|
||||||
|
|
||||||
export { LocalRecorderState } from './OpenViduInternal/Enums/LocalRecorderState';
|
export { LocalRecorderState } from './OpenViduInternal/Enums/LocalRecorderState';
|
||||||
export { OpenViduError, OpenViduErrorName } from './OpenViduInternal/Enums/OpenViduError';
|
export { OpenViduError, OpenViduErrorName } from './OpenViduInternal/Enums/OpenViduError';
|
||||||
|
export { TypeOfVideo } from './OpenViduInternal/Enums/TypeOfVideo';
|
||||||
export { VideoInsertMode } from './OpenViduInternal/Enums/VideoInsertMode';
|
export { VideoInsertMode } from './OpenViduInternal/Enums/VideoInsertMode';
|
||||||
|
|
||||||
export { Event } from './OpenViduInternal/Events/Event';
|
export { Event } from './OpenViduInternal/Events/Event';
|
||||||
|
|
Loading…
Reference in New Issue