mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: support other browsers in iOS
parent
654a92de8c
commit
6ac6adbeea
|
@ -341,7 +341,8 @@ export class OpenVidu {
|
||||||
checkSystemRequirements(): number {
|
checkSystemRequirements(): number {
|
||||||
|
|
||||||
if (platform.isIPhoneOrIPad()) {
|
if (platform.isIPhoneOrIPad()) {
|
||||||
if (platform.isIOSWithSafari() || platform.isIonicIos()) {
|
if (platform.isIOSWithSafari() || platform.isIonicIos() ||
|
||||||
|
platform.isChromeMobileBrowser() || platform.isEdgeMobileBrowser() || platform.isOperaMobileBrowser() || platform.isFirefoxMobileBrowser()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -703,7 +703,7 @@ export class Publisher extends StreamManager {
|
||||||
this.videoReference = document.createElement('video');
|
this.videoReference = document.createElement('video');
|
||||||
this.videoReference.setAttribute('muted', 'true');
|
this.videoReference.setAttribute('muted', 'true');
|
||||||
this.videoReference.style.display = 'none';
|
this.videoReference.style.display = 'none';
|
||||||
if (platform.isSafariBrowser()) {
|
if (platform.isSafariBrowser() || (platform.isIPhoneOrIPad() && (platform.isChromeMobileBrowser() || platform.isEdgeMobileBrowser() || platform.isOperaMobileBrowser() || platform.isFirefoxMobileBrowser()))) {
|
||||||
this.videoReference.setAttribute('playsinline', 'true');
|
this.videoReference.setAttribute('playsinline', 'true');
|
||||||
}
|
}
|
||||||
this.stream.setMediaStream(mediaStream);
|
this.stream.setMediaStream(mediaStream);
|
||||||
|
|
|
@ -135,7 +135,7 @@ export class StreamManager extends EventDispatcher {
|
||||||
id: '',
|
id: '',
|
||||||
canplayListenerAdded: false
|
canplayListenerAdded: false
|
||||||
};
|
};
|
||||||
if (platform.isSafariBrowser()) {
|
if (platform.isSafariBrowser() || (platform.isIPhoneOrIPad() && (platform.isChromeMobileBrowser() || platform.isEdgeMobileBrowser() || platform.isOperaMobileBrowser() || platform.isFirefoxMobileBrowser()))) {
|
||||||
this.firstVideoElement.video.setAttribute('playsinline', 'true');
|
this.firstVideoElement.video.setAttribute('playsinline', 'true');
|
||||||
}
|
}
|
||||||
this.targetElement = targEl;
|
this.targetElement = targEl;
|
||||||
|
@ -425,7 +425,7 @@ export class StreamManager extends EventDispatcher {
|
||||||
video.autoplay = true;
|
video.autoplay = true;
|
||||||
video.controls = false;
|
video.controls = false;
|
||||||
|
|
||||||
if (platform.isSafariBrowser()) {
|
if (platform.isSafariBrowser() || (platform.isIPhoneOrIPad() && (platform.isChromeMobileBrowser() || platform.isEdgeMobileBrowser() || platform.isOperaMobileBrowser() || platform.isFirefoxMobileBrowser()))) {
|
||||||
video.setAttribute('playsinline', 'true');
|
video.setAttribute('playsinline', 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ export class PlatformUtils {
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
public isFirefoxMobileBrowser(): boolean {
|
public isFirefoxMobileBrowser(): boolean {
|
||||||
return platform.name === "Firefox Mobile";
|
return platform.name === "Firefox Mobile" || platform.name === "Firefox for iOS";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@ export class PlatformUtils {
|
||||||
*/
|
*/
|
||||||
public isEdgeMobileBrowser(): boolean {
|
public isEdgeMobileBrowser(): boolean {
|
||||||
const version = platform?.version ? parseFloat(platform.version) : -1;
|
const version = platform?.version ? parseFloat(platform.version) : -1;
|
||||||
return platform.name === "Microsoft Edge" && platform.os?.family === 'Android' && version > 45;
|
return platform.name === "Microsoft Edge" && (platform.os?.family === 'Android' || platform.os?.family === 'iOS') && version > 45;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,14 +102,12 @@ export class PlatformUtils {
|
||||||
*/
|
*/
|
||||||
public isIPhoneOrIPad(): boolean {
|
public isIPhoneOrIPad(): boolean {
|
||||||
const userAgent = !!platform.ua ? platform.ua : navigator.userAgent;
|
const userAgent = !!platform.ua ? platform.ua : navigator.userAgent;
|
||||||
|
|
||||||
const isTouchable = "ontouchend" in document;
|
const isTouchable = "ontouchend" in document;
|
||||||
const isIPad = /\b(\w*Macintosh\w*)\b/.test(userAgent) && isTouchable;
|
const isIPad = /\b(\w*Macintosh\w*)\b/.test(userAgent) && isTouchable;
|
||||||
const isIPhone =
|
const isIPhone =
|
||||||
/\b(\w*iPhone\w*)\b/.test(userAgent) &&
|
/\b(\w*iPhone\w*)\b/.test(userAgent) &&
|
||||||
/\b(\w*Mobile\w*)\b/.test(userAgent) &&
|
/\b(\w*Mobile\w*)\b/.test(userAgent) &&
|
||||||
isTouchable;
|
isTouchable;
|
||||||
|
|
||||||
return isIPad || isIPhone;
|
return isIPad || isIPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue