Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Use mjpeg streaming if browser is safari on ios
Browse files Browse the repository at this point in the history
Connects-to: #34
Signed-off-by: Marios Balamatsias <mbalamatsias@gmail.com>
  • Loading branch information
mbalamat committed Jun 17, 2019
1 parent 8222c05 commit 8c19e5b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions balena-cam/app/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,11 @@ function startMJPEG() {
showContainer('mjpeg');
}

if (window.navigator.userAgent.indexOf("Edge") > -1) {
//state 3 means the client is a Microsoft Edge
var isSafari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/);
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
var safariOnIos = isSafari && iOS;
if (window.navigator.userAgent.indexOf("Edge") > -1 || safariOnIos) {
//state 3 means the client is a Microsoft Edge or Safari on iOS
state = 3;
startMJPEG();
} else {
Expand Down

0 comments on commit 8c19e5b

Please sign in to comment.