1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Rename to match MSC3077

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2021-04-04 08:37:09 +02:00
parent e78b415832
commit cdc0d5623b
2 changed files with 10 additions and 10 deletions

View File

@@ -29,7 +29,7 @@ import {EventType} from '../@types/event';
import { RoomMember } from '../models/room-member'; import { RoomMember } from '../models/room-member';
import { randomString } from '../randomstring'; import { randomString } from '../randomstring';
import { MCallReplacesEvent, MCallAnswer, MCallOfferNegotiate, CallCapabilities } from './callEventTypes'; import { MCallReplacesEvent, MCallAnswer, MCallOfferNegotiate, CallCapabilities } from './callEventTypes';
import { CallFeed, CallFeedType } from './callFeed'; import { CallFeed, CallFeedPurpose } from './callFeed';
// events: hangup, error(err), replaced(call), state(state, oldState) // events: hangup, error(err), replaced(call), state(state, oldState)
@@ -417,14 +417,14 @@ export class MatrixCall extends EventEmitter {
return !this.feeds.some((feed) => !feed.isLocal()); return !this.feeds.some((feed) => !feed.isLocal());
} }
private pushNewFeed(stream: MediaStream, userId: string, type: CallFeedType) { private pushNewFeed(stream: MediaStream, userId: string, purpose: CallFeedPurpose) {
// Try to find a feed with the same stream id as the new stream, // Try to find a feed with the same stream id as the new stream,
// if we find it replace the old stream with the new one // if we find it replace the old stream with the new one
const feed = this.feeds.find((feed) => feed.stream.id === stream.id); const feed = this.feeds.find((feed) => feed.stream.id === stream.id);
if (feed) { if (feed) {
feed.setNewStream(stream); feed.setNewStream(stream);
} else { } else {
this.feeds.push(new CallFeed(stream, userId, type, this.client, this.roomId)); this.feeds.push(new CallFeed(stream, userId, purpose, this.client, this.roomId));
this.emit(CallEvent.FeedsChanged, this.feeds); this.emit(CallEvent.FeedsChanged, this.feeds);
} }
} }
@@ -770,9 +770,9 @@ export class MatrixCall extends EventEmitter {
logger.debug( logger.debug(
"Setting screen sharing stream to the local video element", "Setting screen sharing stream to the local video element",
); );
this.pushNewFeed(this.screenSharingStream, this.client.getUserId(), CallFeedType.Screenshare); this.pushNewFeed(this.screenSharingStream, this.client.getUserId(), CallFeedPurpose.Screenshare);
} else { } else {
this.pushNewFeed(stream, this.client.getUserId(), CallFeedType.Webcam); this.pushNewFeed(stream, this.client.getUserId(), CallFeedPurpose.Usermedia);
} }
// why do we enable audio (and only audio) tracks here? -- matthew // why do we enable audio (and only audio) tracks here? -- matthew
@@ -842,7 +842,7 @@ export class MatrixCall extends EventEmitter {
return; return;
} }
this.pushNewFeed(stream, this.client.getUserId(), CallFeedType.Webcam); this.pushNewFeed(stream, this.client.getUserId(), CallFeedPurpose.Usermedia);
this.localAVStream = stream; this.localAVStream = stream;
logger.info("Got local AV stream with id " + this.localAVStream.id); logger.info("Got local AV stream with id " + this.localAVStream.id);
@@ -1266,7 +1266,7 @@ export class MatrixCall extends EventEmitter {
logger.debug(`Track id ${ev.track.id} of kind ${ev.track.kind} added`); logger.debug(`Track id ${ev.track.id} of kind ${ev.track.kind} added`);
this.pushNewFeed(this.remoteStream, this.getOpponentMember().userId, CallFeedType.Webcam) this.pushNewFeed(this.remoteStream, this.getOpponentMember().userId, CallFeedPurpose.Usermedia)
logger.info("playing remote. stream active? " + this.remoteStream.active); logger.info("playing remote. stream active? " + this.remoteStream.active);
}; };

View File

@@ -16,8 +16,8 @@ limitations under the License.
import EventEmitter from "events"; import EventEmitter from "events";
export enum CallFeedType { export enum CallFeedPurpose {
Webcam = "webcam", Usermedia = "usermedia",
Screenshare = "screenshare", Screenshare = "screenshare",
} }
@@ -29,7 +29,7 @@ export class CallFeed extends EventEmitter {
constructor( constructor(
public stream: MediaStream, public stream: MediaStream,
public userId: string, public userId: string,
public type: CallFeedType, public purpose: CallFeedPurpose,
private client: any, // Fix when client is TSified private client: any, // Fix when client is TSified
private roomId: string, private roomId: string,
) { ) {