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 { StreamPropertyChangedEvent } from '../OpenViduInternal/Events/StreamPropertyChangedEvent';
|
||||
import { OpenViduError, OpenViduErrorName } from '../OpenViduInternal/Enums/OpenViduError';
|
||||
import { TypeOfVideo } from '../OpenViduInternal/Enums/TypeOfVideo';
|
||||
import { OpenViduLogger } from '../OpenViduInternal/Logger/OpenViduLogger';
|
||||
import { PlatformUtils } from '../OpenViduInternal/Utils/Platform';
|
||||
|
||||
|
@ -117,7 +118,7 @@ export class Stream {
|
|||
*
|
||||
* 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
|
||||
|
@ -264,9 +265,9 @@ export class Stream {
|
|||
this.videoActive = !!this.outboundStreamOpts.publisherProperties.publishVideo;
|
||||
this.frameRate = this.outboundStreamOpts.publisherProperties.frameRate;
|
||||
if (typeof MediaStreamTrack !== 'undefined' && this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack) {
|
||||
this.typeOfVideo = 'CUSTOM';
|
||||
this.typeOfVideo = TypeOfVideo.CUSTOM;
|
||||
} else {
|
||||
this.typeOfVideo = this.isSendScreen() ? 'SCREEN' : 'CAMERA';
|
||||
this.typeOfVideo = this.isSendScreen() ? TypeOfVideo.SCREEN : TypeOfVideo.CAMERA;
|
||||
}
|
||||
}
|
||||
if (!!this.outboundStreamOpts.publisherProperties.filter) {
|
||||
|
@ -864,9 +865,9 @@ export class Stream {
|
|||
sdpString: sdpOfferParam
|
||||
}
|
||||
} else {
|
||||
let typeOfVideo = '';
|
||||
let typeOfVideo;
|
||||
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 = {
|
||||
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)]) },
|
||||
iceServers: this.getIceServersConf(),
|
||||
mediaStream: this.mediaStream,
|
||||
mediaServer: this.session.openvidu.mediaServer
|
||||
mediaServer: this.session.openvidu.mediaServer,
|
||||
typeOfVideo: this.typeOfVideo
|
||||
};
|
||||
|
||||
if (this.session.openvidu.mediaServer !== 'mediasoup') {
|
||||
|
@ -1092,7 +1094,8 @@ export class Stream {
|
|||
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)]) },
|
||||
iceServers: this.getIceServersConf(),
|
||||
mediaServer: this.session.openvidu.mediaServer
|
||||
mediaServer: this.session.openvidu.mediaServer,
|
||||
typeOfVideo: this.typeOfVideo
|
||||
};
|
||||
|
||||
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 { Filter } from '../../../OpenVidu/Filter';
|
||||
import { TypeOfVideo } from '../../Enums/TypeOfVideo';
|
||||
|
||||
export interface InboundStreamOptions {
|
||||
id: string;
|
||||
|
@ -26,7 +27,7 @@ export interface InboundStreamOptions {
|
|||
hasVideo: boolean;
|
||||
audioActive: boolean;
|
||||
videoActive: boolean;
|
||||
typeOfVideo: string;
|
||||
typeOfVideo: TypeOfVideo;
|
||||
frameRate: number;
|
||||
videoDimensions: { width: number, height: number };
|
||||
filter?: Filter;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
import { Filter } from '../../../OpenVidu/Filter';
|
||||
import { TypeOfVideo } from '../../Enums/TypeOfVideo';
|
||||
|
||||
export interface StreamOptionsServer {
|
||||
id: string;
|
||||
|
@ -24,7 +25,7 @@ export interface StreamOptionsServer {
|
|||
hasVideo: boolean;
|
||||
audioActive: boolean;
|
||||
videoActive: boolean;
|
||||
typeOfVideo: string;
|
||||
typeOfVideo: TypeOfVideo;
|
||||
frameRate: number;
|
||||
videoDimensions: string;
|
||||
filter: Filter;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
import freeice = require('freeice');
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { TypeOfVideo } from '../Enums/TypeOfVideo';
|
||||
import { ExceptionEventName } from '../Events/ExceptionEvent';
|
||||
import { OpenViduLogger } from '../Logger/OpenViduLogger';
|
||||
import { PlatformUtils } from '../Utils/Platform';
|
||||
|
@ -104,6 +105,7 @@ export interface WebRtcPeerConfiguration {
|
|||
mediaStream?: MediaStream | null;
|
||||
mode?: 'sendonly' | 'recvonly' | 'sendrecv';
|
||||
id?: string;
|
||||
typeOfVideo: TypeOfVideo | undefined
|
||||
}
|
||||
|
||||
export class WebRtcPeer {
|
||||
|
@ -133,6 +135,7 @@ export class WebRtcPeer {
|
|||
: null,
|
||||
mode: !!configuration.mode ? configuration.mode : "sendrecv",
|
||||
id: !!configuration.id ? configuration.id : this.generateUniqueId(),
|
||||
typeOfVideo: configuration.typeOfVideo
|
||||
};
|
||||
|
||||
this.pc = new RTCPeerConnection({ iceServers: this.configuration.iceServers });
|
||||
|
|
|
@ -12,6 +12,7 @@ export { Filter } from './OpenVidu/Filter';
|
|||
|
||||
export { LocalRecorderState } from './OpenViduInternal/Enums/LocalRecorderState';
|
||||
export { OpenViduError, OpenViduErrorName } from './OpenViduInternal/Enums/OpenViduError';
|
||||
export { TypeOfVideo } from './OpenViduInternal/Enums/TypeOfVideo';
|
||||
export { VideoInsertMode } from './OpenViduInternal/Enums/VideoInsertMode';
|
||||
|
||||
export { Event } from './OpenViduInternal/Events/Event';
|
||||
|
|
Loading…
Reference in New Issue