Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | 1x 1x 1x 1x | import { StreamManager, Publisher } from 'openvidu-browser'; import { VideoType } from '../models/video-type.model'; /** * Packs all the information about the user */ export class UserModel { /** * The Connection ID that is publishing the stream */ connectionId: string; /** * The user nickname */ nickname: string; /** * StreamManager object ([[Publisher]] or [[Subscriber]]) */ streamManager: StreamManager; /** * @hidden */ local: boolean; /** * @hidden */ videoSizeBig: boolean; /** * @hidden */ constructor(connectionId?: string, streamManager?: StreamManager, nickname?: string) { this.connectionId = connectionId || ''; this.nickname = nickname || 'OpenVidu'; this.streamManager = streamManager || null; } /** * Return `true` if audio track is active and `false` if audio track is muted */ public isAudioActive(): boolean { // console.log("isAudioActive"); return (<Publisher>this.streamManager)?.stream?.audioActive; } /** * Return `true` if video track is active and `false` if video track is muted */ public isVideoActive(): boolean { // console.log("isVideoActive"); return (<Publisher>this.streamManager)?.stream?.videoActive; } /** * Return the connection ID */ public getConnectionId(): string { return this.streamManager?.stream?.connection?.connectionId || this.connectionId; } /** * Return the user nickname */ public getNickname(): string { return this.nickname; } /** * Return the [[streamManger]] object */ public getStreamManager(): StreamManager { return this.streamManager; } /** * Return `true` if user has a local role and `false` if not */ public isLocal(): boolean { return this.local; } /** * Return `true` if user has a remote role and `false` if not */ public isRemote(): boolean { return (<Publisher>this.streamManager)?.remote; } /** * Return `true` if user has a screen role and `false` if not */ public isScreen(): boolean { // console.log("isScreen"); return (<Publisher>this.streamManager)?.stream?.typeOfVideo === VideoType.SCREEN; } /** * Return `true` if user has a camera role and `false` if not */ public isCamera(): boolean { // console.log("CCC"); return (<Publisher>this.streamManager)?.stream?.typeOfVideo === VideoType.CAMERA || (this.isLocal() && !this.isScreen()); } /** * Set the streamManager value object * @param streamManager value of streamManager */ public setStreamManager(streamManager: StreamManager) { this.streamManager = streamManager; } /** * Set the user nickname value * @param nickname value of user nickname */ public setNickname(nickname: string) { this.nickname = nickname; } public isVideoSizeBig(): boolean { return this.videoSizeBig; } /** * @hidden */ public setVideoSizeBig(big: boolean) { this.videoSizeBig = big; } /** * @hidden */ // Used when the streamManager is null (users without devices) public setLocal(local: boolean) { this.local = local; } } |