Remove addStream from Javascript

Not supported in Safari
This commit is contained in:
Sean DuBois
2020-11-19 21:23:57 -08:00
parent 74e790aa11
commit d0b119af2a
2 changed files with 3 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ go get github.com/pion/webrtc/v3/examples/broadcast
```
### Open broadcast example page
[jsfiddle.net](https://jsfiddle.net/d2mt13y6/) You should see two buttons 'Publish a Broadcast' and 'Join a Broadcast'
[jsfiddle.net](https://jsfiddle.net/1jc4go7v/) You should see two buttons 'Publish a Broadcast' and 'Join a Broadcast'
### Run Broadcast
#### Linux/macOS

View File

@@ -21,7 +21,8 @@ window.createSession = isPublisher => {
if (isPublisher) {
navigator.mediaDevices.getUserMedia({ video: true, audio: false })
.then(stream => {
pc.addStream(document.getElementById('video1').srcObject = stream)
stream.getTracks().forEach(track => pc.addTrack(track, stream));
document.getElementById('video1').srcObject = stream
pc.createOffer()
.then(d => pc.setLocalDescription(d))
.catch(log)