You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Make MatrixCall use CallFeed
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -14,15 +14,40 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import EventEmitter from "events";
|
||||
|
||||
export enum CallFeedType {
|
||||
Webcam = "webcam",
|
||||
Screenshare = "screenshare",
|
||||
}
|
||||
|
||||
export class CallFeed {
|
||||
export enum CallFeedEvent {
|
||||
NewStream = "new_stream",
|
||||
}
|
||||
|
||||
export class CallFeed extends EventEmitter {
|
||||
constructor(
|
||||
public stream: MediaStream,
|
||||
public userId: string,
|
||||
public type: CallFeedType,
|
||||
) {}
|
||||
private client: any, // Fix when client is TSified
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
public isLocal() {
|
||||
return this.userId === this.client.getUserId();
|
||||
}
|
||||
|
||||
// TODO: This should be later replaced by a method
|
||||
// that will also check if the remote is muted.
|
||||
public isAudioOnly(): boolean {
|
||||
// We assume only one video track
|
||||
return !this.stream.getTracks().some((track) => track.kind === "video");
|
||||
}
|
||||
|
||||
public setNewStream(newStream: MediaStream) {
|
||||
this.stream = newStream;
|
||||
this.emit(CallFeedEvent.NewStream, this.stream);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user