HTML5 video iOS support
This commit is contained in:
parent
ce1b0ca85e
commit
5d2a78a5ce
@ -87,11 +87,15 @@ export default class VideoDock extends Component {
|
||||
const webRtcPeer = this.state.webRtcPeers[parsedMessage.cameraId];
|
||||
|
||||
if (webRtcPeer !== null) {
|
||||
webRtcPeer.addIceCandidate(parsedMessage.candidate, (err) => {
|
||||
if (err) {
|
||||
return log('error', `Error adding candidate: ${err}`);
|
||||
}
|
||||
});
|
||||
if (webRtcPeer.didSDPAnswered) {
|
||||
webRtcPeer.addIceCandidate(parsedMessage.candidate, (err) => {
|
||||
if (err) {
|
||||
return log('error', `Error adding candidate: ${err}`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
webRtcPeer.iceQueue.push(parsedMessage.candidate);
|
||||
}
|
||||
} else {
|
||||
log('error', ' [ICE] Message arrived before webRtcPeer?');
|
||||
}
|
||||
@ -119,13 +123,23 @@ export default class VideoDock extends Component {
|
||||
that.sendMessage(message);
|
||||
};
|
||||
|
||||
var videoConstraints = {};
|
||||
if (!!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)) { // Custom constraints for Safari
|
||||
videoConstraints = {
|
||||
width: {min:320, max:640},
|
||||
height: {min:240, max:480}
|
||||
}
|
||||
} else {
|
||||
videoConstraints = {
|
||||
width: {min: 320, ideal: 320},
|
||||
height: {min: 240, ideal:240},
|
||||
frameRate: {min: 5, ideal: 10}
|
||||
};
|
||||
}
|
||||
|
||||
const options = {
|
||||
mediaConstraints: { audio: false,
|
||||
video: {
|
||||
width: {min: 320, ideal: 320},
|
||||
height: {min: 240, ideal:240},
|
||||
frameRate: { min: 5, ideal: 10}
|
||||
}
|
||||
video: videoConstraints
|
||||
},
|
||||
onicecandidate: onIceCandidate,
|
||||
};
|
||||
@ -143,6 +157,7 @@ export default class VideoDock extends Component {
|
||||
options.remoteVideo.height = 90;
|
||||
options.remoteVideo.autoplay = true;
|
||||
options.remoteVideo.playsinline = true;
|
||||
options.remoteVideo.muted = true;
|
||||
|
||||
document.getElementById('webcamArea').appendChild(options.remoteVideo);
|
||||
}
|
||||
@ -154,6 +169,9 @@ export default class VideoDock extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
this.didSDPAnswered = false;
|
||||
this.iceQueue = [];
|
||||
|
||||
if (shareWebcam) {
|
||||
that.state.sharedWebcam = that.state.webRtcPeers[id];
|
||||
that.state.myId = id;
|
||||
@ -173,6 +191,15 @@ export default class VideoDock extends Component {
|
||||
};
|
||||
that.sendMessage(message);
|
||||
});
|
||||
while (this.iceQueue.length) {
|
||||
var candidate = this.iceQueue.shift();
|
||||
this.addIceCandidate(candidate, (err) => {
|
||||
if (err) {
|
||||
return console.error(`Error adding candidate: ${err}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.didSDPAnswered = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user