Rename modes to mode in JS player

This commit is contained in:
Alexey Khit
2022-12-04 22:38:21 +03:00
parent e64919838c
commit ea79da0d53
+6 -6
View File
@@ -111,7 +111,7 @@ class VideoRTC extends HTMLElement {
* Supported modes (webrtc, mse, mse2, mp4, mjpeg). * Supported modes (webrtc, mse, mse2, mp4, mjpeg).
* @type {string} * @type {string}
*/ */
this.modes = "webrtc,mse,mp4"; this.mode = "webrtc,mse,mp4";
/** /**
* Run stream when not displayed on the screen. Default `false`. * Run stream when not displayed on the screen. Default `false`.
@@ -352,21 +352,21 @@ class VideoRTC extends HTMLElement {
// CONNECTING => OPEN // CONNECTING => OPEN
this.wsState = WebSocket.OPEN; this.wsState = WebSocket.OPEN;
if (this.modes.indexOf("mse") >= 0 && "MediaSource" in window) { // iPhone if (this.mode.indexOf("mse") >= 0 && "MediaSource" in window) { // iPhone
if (this.modes.indexOf("mse2") >= 0 && MediaSource.canConstructInDedicatedWorker) { if (this.mode.indexOf("mse2") >= 0 && MediaSource.canConstructInDedicatedWorker) {
this.internalMSE2(); this.internalMSE2();
} else { } else {
this.internalMSE(); this.internalMSE();
} }
} else if (this.modes.indexOf("mp4") >= 0) { } else if (this.mode.indexOf("mp4") >= 0) {
this.internalMP4(); this.internalMP4();
} }
if (this.modes.indexOf("webrtc") >= 0 && "RTCPeerConnection" in window) { // macOS Desktop app if (this.mode.indexOf("webrtc") >= 0 && "RTCPeerConnection" in window) { // macOS Desktop app
this.internalRTC(); this.internalRTC();
} }
if (this.modes.indexOf("mjpeg") >= 0) { if (this.mode.indexOf("mjpeg") >= 0) {
this.internalMJPEG(); this.internalMJPEG();
} }
}); });