webrtc-streamer 0.6.5 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,11 +1,15 @@
1
1
  <html>
2
2
  <head>
3
3
  <link rel="icon" type="image/png" href="webrtc.png" />
4
- <script src="libs/tfjs"> </script>
5
- <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd"> </script>
6
- <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/posenet"> </script>
7
- <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/deeplab"> </script>
8
- <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/body-pix@2.0"></script>
4
+ <script src="libs/tfjs"></script>
5
+ <script src="libs/tf-backend-wasm.js"></script>
6
+ <script>
7
+ tf.setBackend('wasm').then(() => main());
8
+ </script>
9
+ <script src="libs/coco-ssd"> </script>
10
+ <script src="libs/posenet"> </script>
11
+ <script src="libs/deeplab"> </script>
12
+ <script src="libs/body-pix"></script>
9
13
  <script type="module" src="webrtc-streamer-element.js"></script>
10
14
  <script type="module" src="webrtc-streamer-footer-element.js"></script>
11
15
  <script type="module" src="webrtc-streamer-menu-element.js"></script>
@@ -1,6 +1,6 @@
1
1
  import "./libs/adapter.min.js";
2
2
  import "./tensorflow.js";
3
- import WebRtcStreamer from "./webrtcstreamer.js";
3
+ import "./webrtcstreamer.js";
4
4
 
5
5
  class WebRTCStreamerElement extends HTMLElement {
6
6
  static get observedAttributes() {
@@ -84,14 +84,14 @@ class WebRTCStreamerElement extends HTMLElement {
84
84
  let imgLoaded;
85
85
  if (reconnect) {
86
86
  this.disconnectStream();
87
- this.webRtcServer = new WebRtcStreamer(this.videoElement, webrtcurl);
88
- this.webRtcServer.connect(videostream, audiostream, this.getAttribute("options"));
89
87
 
90
88
  imgLoaded = new Promise( (resolve,rejet) => {
91
- this.videoElement.addEventListener('loadeddata', (event) => {
92
- resolve(event)
93
- });
89
+ this.videoElement.addEventListener('loadedmetadata', () => resolve(), { once: true });
94
90
  } );
91
+
92
+ this.webRtcServer = new WebRtcStreamer(this.videoElement, webrtcurl);
93
+ this.webRtcServer.connect(videostream, audiostream, this.getAttribute("options"));
94
+
95
95
  } else {
96
96
  imgLoaded = new Promise( (resolve) => resolve() );
97
97
  }
@@ -101,7 +101,7 @@ class WebRTCStreamerElement extends HTMLElement {
101
101
  Promise.all([imgLoaded, modelLoaded]).then(([event,model]) => {
102
102
  this.setVideoSize(this.videoElement.videoWidth, this.videoElement.videoHeight)
103
103
 
104
- if (model) {
104
+ if (model && modelLoaded.run) {
105
105
  model.run = modelLoaded.run;
106
106
  model.run(model, this.videoElement, this.canvasElement)
107
107
  modelLoaded.model = model;
@@ -57,8 +57,11 @@ WebRtcStreamer.prototype.connect = function(videourl, audiourl, options, localst
57
57
  * Disconnect a WebRTC Stream and clear videoElement source
58
58
  */
59
59
  WebRtcStreamer.prototype.disconnect = function() {
60
- if (this.videoElement) {
61
- this.videoElement.src = "";
60
+ if (this.videoElement?.srcObject) {
61
+ this.videoElement.srcObject.getTracks().forEach(track => {
62
+ track.stop()
63
+ this.videoElement.srcObject.removeTrack(track);
64
+ });
62
65
  }
63
66
  if (this.pc) {
64
67
  fetch(this.srvurl + "/api/hangup?peerid="+this.pc.peerid)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webrtc-streamer",
3
- "version": "0.6.5",
3
+ "version": "0.7.0",
4
4
  "description": "",
5
5
  "main": "joinjanusvideoroom.js",
6
6
  "dependencies": {
@@ -18,5 +18,5 @@
18
18
  "url": "https://github.com/mpromonet/webrtc-streamer/"
19
19
  },
20
20
  "author": "Michel Promonet",
21
- "license": "UNLICENSED"
21
+ "license": "Unlicense"
22
22
  }