Skip to content

Commit 4e271f7

Browse files
jamiegoodSean-Der
authored andcommitted
Fix JS Error in gocv-receive
Fixed js error when using safari due to deprecated addStream() Updated js fiddle example to use addTrack() method instead.
1 parent 1086db6 commit 4e271f7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

gocv-receive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ go get github.com/pion/example-webrtc-applications/gocv-receive
1818
```
1919

2020
### Open gocv-receive example page
21-
[jsfiddle.net](https://jsfiddle.net/Lsfkexmt/) you should see your Webcam, two text-areas and a 'Start Session' button
21+
[jsfiddle.net](https://jsfiddle.net/nerhsvpg/) you should see your Webcam, two text-areas and a 'Start Session' button
2222

2323
### Run gocv-receive with your browsers SessionDescription as stdin
2424
In the jsfiddle the top textarea is your browser, copy that and:

gocv-receive/jsfiddle/demo.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ var log = msg => {
1313

1414
navigator.mediaDevices.getUserMedia({ video: true, audio: false })
1515
.then(stream => {
16-
pc.addStream(document.getElementById('video1').srcObject = stream)
16+
17+
document.getElementById('video1').srcObject = stream
18+
19+
stream.getTracks().forEach(function(track) {
20+
pc.addTrack(track, stream);
21+
});
22+
1723
pc.createOffer().then(d => pc.setLocalDescription(d)).catch(log)
1824
}).catch(log)
1925

0 commit comments

Comments
 (0)