Skip to content

Commit

Permalink
修复移动端 web全屏问题
Browse files Browse the repository at this point in the history
  • Loading branch information
bosscheng committed Jun 12, 2024
1 parent 0da1e0f commit df38c3a
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 17 deletions.
Binary file modified demo/public/dist.zip
Binary file not shown.
Binary file modified demo/public/pro.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/public/pro/js/decoder-pro-audio.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/pro/js/decoder-pro-hard-not-wasm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/pro/js/decoder-pro-hard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/pro/js/decoder-pro-mt.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/pro/js/decoder-pro-simd-mt.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/pro/js/decoder-pro-simd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/pro/js/decoder-pro.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/pro/js/jessibuca-pro-demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/public/pro/js/jessibuca-pro-multi-demo.js

Large diffs are not rendered by default.

Binary file modified demo/public/qrcode.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dist/jessibuca.js

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions src/player/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import events from './events';
import {
fpsStatus,
initPlayTimes,
isEmpty,
isEmpty, isFalse,
isFullScreen, isMobile,
isNotEmpty,
now, supportMediaStreamTrack,
Expand Down Expand Up @@ -40,17 +40,24 @@ export default class Player extends Emitter {
// disable offscreen
this._opt.forceNoOffscreen = true;

if (isMobile()) {
if (isMobile() || isPad()) {
this.debug.log('Player', 'isMobile and set _opt.controlAutoHide false');
this._opt.controlAutoHide = false;
}

if (screenfull.isEnabled &&
this._opt.useWebFullScreen) {
this.debug.log('Player', 'screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false');
this._opt.useWebFullScreen = false;
}
if (screenfull.isEnabled &&
this._opt.useWebFullScreen) {
this.debug.log('Player', 'screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false');
this._opt.useWebFullScreen = false;
}

if (isFalse(screenfull.isEnabled) &&
isFalse(this._opt.useWebFullScreen)) {
this.debug.log('Player', 'screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true');
this._opt.useWebFullScreen = true;
}


//
if (this._opt.useWCS) {
this._opt.useWCS = supportWCS();
Expand Down
13 changes: 13 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ export function isMobile() {
return (/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase()));
}

export function isPad(){
return (/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()));
}

export function isAndroid() {
const UA = window.navigator.userAgent.toLowerCase();
return (/android/i.test(UA));
Expand Down Expand Up @@ -613,3 +617,12 @@ export function hevcEncoderNalePacketNotLength(oneNALBuffer, isIframe) {
arrayBuffer.set(oneNALBuffer, tmp.length);
return arrayBuffer;
}


export function isTrue(value) {
return value === true || value === 'true';
}

export function isFalse(value) {
return value !== true && value !== 'true';
}

0 comments on commit df38c3a

Please sign in to comment.