Video player fixes for iOS
Minor fixes
This commit is contained in:
parent
b720951241
commit
4558caa598
@ -8,7 +8,7 @@ const app = express();
|
|||||||
const thirdTour = process.argv[2] == 3;
|
const thirdTour = process.argv[2] == 3;
|
||||||
|
|
||||||
const publicFolderName = thirdTour ? 'public3' : 'public';
|
const publicFolderName = thirdTour ? 'public3' : 'public';
|
||||||
const port = thirdTour ? 8443 : 443;
|
const port = thirdTour ? 8443 : 8443;
|
||||||
|
|
||||||
app.use(compression());
|
app.use(compression());
|
||||||
app.use(express.static(publicFolderName));
|
app.use(express.static(publicFolderName));
|
||||||
|
@ -41,6 +41,10 @@ class AppMediaPlaybackController {
|
|||||||
//const source = document.createElement('source');
|
//const source = document.createElement('source');
|
||||||
//source.type = doc.type == 'voice' && !opusDecodeController.isPlaySupported() ? 'audio/wav' : doc.mime_type;
|
//source.type = doc.type == 'voice' && !opusDecodeController.isPlaySupported() ? 'audio/wav' : doc.mime_type;
|
||||||
|
|
||||||
|
if(doc.type == 'round') {
|
||||||
|
media.setAttribute('playsinline', '');
|
||||||
|
}
|
||||||
|
|
||||||
media.dataset.mid = '' + mid;
|
media.dataset.mid = '' + mid;
|
||||||
media.dataset.type = doc.type;
|
media.dataset.type = doc.type;
|
||||||
|
|
||||||
|
@ -12,4 +12,9 @@ export const isAndroid = navigator.userAgent.toLowerCase().indexOf('android') !=
|
|||||||
*/
|
*/
|
||||||
const ctx = typeof(window) !== 'undefined' ? window : self;
|
const ctx = typeof(window) !== 'undefined' ? window : self;
|
||||||
|
|
||||||
|
// https://stackoverflow.com/a/58065241
|
||||||
|
export const isAppleMobile = (/iPad|iPhone|iPod/.test(navigator.platform) ||
|
||||||
|
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&
|
||||||
|
!ctx.MSStream;
|
||||||
|
|
||||||
export const isSafari = !!('safari' in ctx) || !!(userAgent && (/\b(iPad|iPhone|iPod)\b/.test(userAgent) || (!!userAgent.match('Safari') && !userAgent.match('Chrome'))))/* || true */;
|
export const isSafari = !!('safari' in ctx) || !!(userAgent && (/\b(iPad|iPhone|iPod)\b/.test(userAgent) || (!!userAgent.match('Safari') && !userAgent.match('Chrome'))))/* || true */;
|
@ -30,6 +30,12 @@ class SwipeHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleTouchStart = (evt: TouchEvent) => {
|
handleTouchStart = (evt: TouchEvent) => {
|
||||||
|
// * Fix for seek input
|
||||||
|
if((evt.target as HTMLElement).tagName == 'INPUT') {
|
||||||
|
this.xDown = this.yDown = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const firstTouch = evt.touches[0];
|
const firstTouch = evt.touches[0];
|
||||||
this.xDown = firstTouch.clientX;
|
this.xDown = firstTouch.clientX;
|
||||||
this.yDown = firstTouch.clientY;
|
this.yDown = firstTouch.clientY;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,7 @@
|
|||||||
import { cancelEvent } from "./utils";
|
import { cancelEvent } from "./utils";
|
||||||
import { touchSupport } from "./config";
|
import { touchSupport } from "./config";
|
||||||
import appMediaPlaybackController from "../components/appMediaPlaybackController";
|
import appMediaPlaybackController from "../components/appMediaPlaybackController";
|
||||||
|
import { isAppleMobile } from "../helpers/userAgent";
|
||||||
|
|
||||||
type SUPEREVENT = MouseEvent | TouchEvent;
|
type SUPEREVENT = MouseEvent | TouchEvent;
|
||||||
|
|
||||||
@ -347,6 +348,8 @@ export default class VideoPlayer {
|
|||||||
onScrub: currentTime => {
|
onScrub: currentTime => {
|
||||||
const value = Math.max(Math.min(currentTime, 1), 0);
|
const value = Math.max(Math.min(currentTime, 1), 0);
|
||||||
|
|
||||||
|
console.log('volume scrub:', currentTime, value);
|
||||||
|
|
||||||
video.muted = false;
|
video.muted = false;
|
||||||
video.volume = value;
|
video.volume = value;
|
||||||
}
|
}
|
||||||
@ -609,6 +612,14 @@ export default class VideoPlayer {
|
|||||||
// alternative standard method
|
// alternative standard method
|
||||||
const player = this.wrapper;
|
const player = this.wrapper;
|
||||||
|
|
||||||
|
// * https://caniuse.com/#feat=fullscreen
|
||||||
|
if(isAppleMobile) {
|
||||||
|
const video = this.video as any;
|
||||||
|
video.webkitEnterFullscreen();
|
||||||
|
video.enterFullscreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!VideoPlayer.isFullScreen()) {
|
if(!VideoPlayer.isFullScreen()) {
|
||||||
player.classList.add('ckin__fullscreen');
|
player.classList.add('ckin__fullscreen');
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import Page from './page';
|
|||||||
import { mediaSizes } from '../lib/config';
|
import { mediaSizes } from '../lib/config';
|
||||||
import passwordManager from '../lib/mtproto/passwordManager';
|
import passwordManager from '../lib/mtproto/passwordManager';
|
||||||
import { AccountPassword } from '../types';
|
import { AccountPassword } from '../types';
|
||||||
|
import { cancelEvent } from '../lib/utils';
|
||||||
|
|
||||||
let onFirstMount = (): Promise<any> => {
|
let onFirstMount = (): Promise<any> => {
|
||||||
let needFrame = 0;
|
let needFrame = 0;
|
||||||
@ -42,25 +43,28 @@ let onFirstMount = (): Promise<any> => {
|
|||||||
getState();
|
getState();
|
||||||
};
|
};
|
||||||
|
|
||||||
toggleVisible.addEventListener('click', function(this, e) {
|
const onVisibilityClick = function(this: typeof toggleVisible, e: Event) {
|
||||||
|
cancelEvent(e);
|
||||||
passwordVisible = !passwordVisible;
|
passwordVisible = !passwordVisible;
|
||||||
|
|
||||||
|
this.classList.toggle('tgico-eye2', passwordVisible);
|
||||||
if(passwordVisible) {
|
if(passwordVisible) {
|
||||||
this.classList.add('tgico-eye2');
|
|
||||||
passwordInput.setAttribute('type', 'text');
|
passwordInput.setAttribute('type', 'text');
|
||||||
animation.setDirection(1);
|
animation.setDirection(1);
|
||||||
animation.curFrame = 0;
|
animation.curFrame = 0;
|
||||||
needFrame = 16;
|
needFrame = 16;
|
||||||
animation.play();
|
animation.play();
|
||||||
} else {
|
} else {
|
||||||
this.classList.remove('tgico-eye2');
|
|
||||||
passwordInput.setAttribute('type', 'password');
|
passwordInput.setAttribute('type', 'password');
|
||||||
animation.setDirection(-1);
|
animation.setDirection(-1);
|
||||||
animation.curFrame = 16;
|
animation.curFrame = 16;
|
||||||
needFrame = 0;
|
needFrame = 0;
|
||||||
animation.play();
|
animation.play();
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
toggleVisible.addEventListener('click', onVisibilityClick);
|
||||||
|
toggleVisible.addEventListener('touchend', onVisibilityClick);
|
||||||
|
|
||||||
let state: AccountPassword;
|
let state: AccountPassword;
|
||||||
|
|
||||||
|
@ -227,6 +227,11 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
width: 50px;
|
width: 50px;
|
||||||
|
|
||||||
|
// https://stackoverflow.com/a/4816050
|
||||||
|
html.is-ios & {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
&__filled {
|
&__filled {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,11 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-word;
|
||||||
|
max-width: 340px;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
span.emoji {
|
span.emoji {
|
||||||
vertical-align: inherit;
|
vertical-align: inherit;
|
||||||
@ -161,6 +166,9 @@
|
|||||||
color: #000;
|
color: #000;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-bio {
|
&-bio {
|
||||||
|
@ -132,6 +132,10 @@ html, body {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
|
|
||||||
|
@include respond-to(handhelds) {
|
||||||
|
height: calc(var(--vh, 1vh) * 100);
|
||||||
|
}
|
||||||
|
|
||||||
/* @include respond-to(handhelds) {
|
/* @include respond-to(handhelds) {
|
||||||
//overflow-y: auto;
|
//overflow-y: auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user