瀏覽代碼

feat(core): update

gemercheung 3 年之前
父節點
當前提交
0c675ed153
共有 2 個文件被更改,包括 45 次插入33 次删除
  1. 18 18
      webrtc/srs.js
  2. 27 15
      webrtc/srsRtc.js

+ 18 - 18
webrtc/srs.js

@@ -10,7 +10,7 @@ const connection = new Connection(testConfig);
 
 console.log("sdk", sdk);
 console.log("sdk", connection);
-const url = "webrtc://demo-kms.4dage.com/live/livestream";
+const url = "webrtc://demo-kms.4dage.com/live/test1";
 sdk.start(url);
 
 console.log("第一个");
@@ -81,24 +81,24 @@ window.connection = connection;
 //   }
 // });
 // 正转
-connection.socket.emit("getVideo", {
-  videoList: ["0/0_1_0", "0/0_1_1", "0/0_1_2"],
-  sessionId: "1",
-  sceneCode: testConfig.sceneCode,
-  roomId: testConfig.roomId,
-  userId: testConfig.userId,
-});
+// connection.socket.emit("getVideo", {
+//   videoList: ["0/0_1_0", "0/0_1_1", "0/0_1_2"],
+//   //   sessionId: "1",
+//   sceneCode: testConfig.sceneCode,
+//   roomId: testConfig.roomId,
+//   userId: testConfig.userId,
+// });
 
-connection.socket.emit("getRotateVideo", {
-  videoPath: "sample-5s",
-  sessionId: "3",
-  sceneCode: testConfig.sceneCode,
-  roomId: testConfig.roomId,
-  userId: testConfig.userId,
-  sangle: "0",
-  eangle: "360",
-  reverses: true,
-});
+// connection.socket.emit("getRotateVideo", {
+//   videoPath: "0/0_1_0",
+//   //   sessionId: "3",
+//   sceneCode: testConfig.sceneCode,
+//   roomId: testConfig.roomId,
+//   userId: testConfig.userId,
+//   sangle: "0",
+//   eangle: "360",
+//   reverses: true,
+// });
 
 connection.socket.on("getSocketVideo", async (data) => {
   console.log("getSocketVideo", data);

+ 27 - 15
webrtc/srsRtc.js

@@ -22,23 +22,35 @@ export class SrsRTC {
       this.onIceCandidate(this.pc, e)
     );
     this.pc.addEventListener("datachannel", this.ondatachannel);
-    this.pc.ondatachannel = (event) => {
-      console.log("ondatachannel", ondatachannel);
-      this.inputChannel.onopen = () => {
-        console.log("连接");
-      };
-      this.inputChannel.onmessage = (event) => {
-        // mark00 rtcp接收
-        console.log("连接", event);
-      };
-      this.inputChannel.close = (event) => {
-        // mark00 rtcp接收
-        console.log("close", event);
-      };
-    };
+    // var dc = this.pc.createDataChannel("datachannel");
+    // dc.onmessage = function (event) {
+    //   console.log("received: " + event.data);
+    // };
+
+    // dc.onopen = function () {
+    //   console.log("datachannel open");
+    // };
+
+    // dc.onclose = function () {
+    //   console.log("datachannel close");
+    // };
+    // this.pc.ondatachannel = (event) => {
+    //   console.log("ondatachannel", event);
+    //   //   this.inputChannel.onopen = () => {
+    //   //     console.log("连接");
+    //   //   };
+    //   //   this.inputChannel.onmessage = (event) => {
+    //   //     // mark00 rtcp接收
+    //   //     console.log("连接", event);
+    //   //   };
+    //   //   this.inputChannel.close = (event) => {
+    //   //     // mark00 rtcp接收
+    //   //     console.log("close", event);
+    //   //   };
+    // };
   }
   onIceCandidate(event) {
-    console.warn("icecandidate", event);
+    // console.warn("icecandidate", event);
   }
   ondatachannel(event) {
     console.warn("ondatachannel", ondatachannel);