mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: Session.capabilities property defined
parent
fa52c1e76a
commit
f8305fce6e
|
@ -21,6 +21,7 @@ import { Publisher } from './Publisher';
|
||||||
import { Stream } from './Stream';
|
import { Stream } from './Stream';
|
||||||
import { StreamManager } from './StreamManager';
|
import { StreamManager } from './StreamManager';
|
||||||
import { Subscriber } from './Subscriber';
|
import { Subscriber } from './Subscriber';
|
||||||
|
import { Capabilities } from '../OpenViduInternal/Interfaces/Public/Capabilities';
|
||||||
import { EventDispatcher } from '../OpenViduInternal/Interfaces/Public/EventDispatcher';
|
import { EventDispatcher } from '../OpenViduInternal/Interfaces/Public/EventDispatcher';
|
||||||
import { SignalOptions } from '../OpenViduInternal/Interfaces/Public/SignalOptions';
|
import { SignalOptions } from '../OpenViduInternal/Interfaces/Public/SignalOptions';
|
||||||
import { SubscriberProperties } from '../OpenViduInternal/Interfaces/Public/SubscriberProperties';
|
import { SubscriberProperties } from '../OpenViduInternal/Interfaces/Public/SubscriberProperties';
|
||||||
|
@ -63,6 +64,12 @@ export class Session implements EventDispatcher {
|
||||||
*/
|
*/
|
||||||
streamManagers: StreamManager[] = [];
|
streamManagers: StreamManager[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object defining the methods that the client is able to call. These are defined by the role of the token used to connect to the Session.
|
||||||
|
* This object is only defined after [[Session.connect]] has been successfully resolved
|
||||||
|
*/
|
||||||
|
capabilities: Capabilities;
|
||||||
|
|
||||||
// This map is only used to avoid race condition between 'joinRoom' response and 'onParticipantPublished' notification
|
// This map is only used to avoid race condition between 'joinRoom' response and 'onParticipantPublished' notification
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
|
@ -889,6 +896,12 @@ export class Session implements EventDispatcher {
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// Initialize capabilities object with the role
|
||||||
|
this.capabilities = {
|
||||||
|
subscribe: 1,
|
||||||
|
publish: this.openvidu.role !== 'SUBSCRIBER' ? 1 : 0
|
||||||
|
};
|
||||||
|
|
||||||
// Initialize local Connection object with values returned by openvidu-server
|
// Initialize local Connection object with values returned by openvidu-server
|
||||||
this.connection = new Connection(this);
|
this.connection = new Connection(this);
|
||||||
this.connection.connectionId = response.id;
|
this.connection.connectionId = response.id;
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2017-2018 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See [[Session.capabilities]]
|
||||||
|
*/
|
||||||
|
export interface Capabilities {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1 if the client can call [[Session.publish]], 0 if not
|
||||||
|
*/
|
||||||
|
publish: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1 if the client can call [[Session.subscribe]], 0 if not (1 for every user for now)
|
||||||
|
*/
|
||||||
|
subscribe: number;
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ export { StreamManagerEvent } from './OpenViduInternal/Events/StreamManagerEvent
|
||||||
export { VideoElementEvent } from './OpenViduInternal/Events/VideoElementEvent';
|
export { VideoElementEvent } from './OpenViduInternal/Events/VideoElementEvent';
|
||||||
export { StreamPropertyChangedEvent } from './OpenViduInternal/Events/StreamPropertyChangedEvent';
|
export { StreamPropertyChangedEvent } from './OpenViduInternal/Events/StreamPropertyChangedEvent';
|
||||||
|
|
||||||
|
export { Capabilities } from './OpenViduInternal/Interfaces/Public/Capabilities';
|
||||||
export { Device } from './OpenViduInternal/Interfaces/Public/Device';
|
export { Device } from './OpenViduInternal/Interfaces/Public/Device';
|
||||||
export { EventDispatcher } from './OpenViduInternal/Interfaces/Public/EventDispatcher';
|
export { EventDispatcher } from './OpenViduInternal/Interfaces/Public/EventDispatcher';
|
||||||
export { OpenViduAdvancedConfiguration } from './OpenViduInternal/Interfaces/Public/OpenViduAdvancedConfiguration';
|
export { OpenViduAdvancedConfiguration } from './OpenViduInternal/Interfaces/Public/OpenViduAdvancedConfiguration';
|
||||||
|
|
Loading…
Reference in New Issue