aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-player-manager.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-12 10:32:56 +0200
committerChocobozzz <me@florianbigard.com>2020-05-12 10:32:56 +0200
commit3e2bc4ea4955ee452d742647683b9021d6b4d6d5 (patch)
treea18736a735cbbf4da2244e713c223d7def8a015c /client/src/assets/player/peertube-player-manager.ts
parent1d05f9bbea70af55ba23679d2db177aefb21f2e7 (diff)
downloadPeerTube-3e2bc4ea4955ee452d742647683b9021d6b4d6d5.tar.gz
PeerTube-3e2bc4ea4955ee452d742647683b9021d6b4d6d5.tar.zst
PeerTube-3e2bc4ea4955ee452d742647683b9021d6b4d6d5.zip
Fix webtorrent play on Safari
Diffstat (limited to 'client/src/assets/player/peertube-player-manager.ts')
-rw-r--r--client/src/assets/player/peertube-player-manager.ts19
1 files changed, 8 insertions, 11 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts
index 5ebc247f2..ebb1e454a 100644
--- a/client/src/assets/player/peertube-player-manager.ts
+++ b/client/src/assets/player/peertube-player-manager.ts
@@ -1,5 +1,3 @@
1import { VideoFile } from '../../../../shared/models/videos'
2import videojs from 'video.js'
3import 'videojs-hotkeys/videojs.hotkeys' 1import 'videojs-hotkeys/videojs.hotkeys'
4import 'videojs-dock' 2import 'videojs-dock'
5import 'videojs-contextmenu-ui' 3import 'videojs-contextmenu-ui'
@@ -20,14 +18,16 @@ import './videojs-components/settings-menu-item'
20import './videojs-components/settings-panel' 18import './videojs-components/settings-panel'
21import './videojs-components/settings-panel-child' 19import './videojs-components/settings-panel-child'
22import './videojs-components/theater-button' 20import './videojs-components/theater-button'
23import { P2PMediaLoaderPluginOptions, UserWatching, VideoJSCaption, VideoJSPluginOptions } from './peertube-videojs-typings' 21import videojs from 'video.js'
24import { buildVideoEmbed, buildVideoLink, copyToClipboard, getRtcConfig } from './utils'
25import { isDefaultLocale } from '../../../../shared/models/i18n/i18n' 22import { isDefaultLocale } from '../../../../shared/models/i18n/i18n'
26import { segmentValidatorFactory } from './p2p-media-loader/segment-validator' 23import { VideoFile } from '../../../../shared/models/videos'
27import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder'
28import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' 24import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
25import { segmentUrlBuilderFactory } from './p2p-media-loader/segment-url-builder'
26import { segmentValidatorFactory } from './p2p-media-loader/segment-validator'
29import { getStoredP2PEnabled } from './peertube-player-local-storage' 27import { getStoredP2PEnabled } from './peertube-player-local-storage'
28import { P2PMediaLoaderPluginOptions, UserWatching, VideoJSCaption, VideoJSPluginOptions } from './peertube-videojs-typings'
30import { TranslationsManager } from './translations-manager' 29import { TranslationsManager } from './translations-manager'
30import { buildVideoEmbed, buildVideoLink, copyToClipboard, getRtcConfig, isIOS, isSafari } from './utils'
31 31
32// Change 'Playback Rate' to 'Speed' (smaller for our settings menu) 32// Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
33(videojs.getComponent('PlaybackRateMenuButton') as any).prototype.controlText_ = 'Speed' 33(videojs.getComponent('PlaybackRateMenuButton') as any).prototype.controlText_ = 'Speed'
@@ -511,15 +511,12 @@ export class PeertubePlayerManager {
511 private static getAutoPlayValue (autoplay: any) { 511 private static getAutoPlayValue (autoplay: any) {
512 if (autoplay !== true) return autoplay 512 if (autoplay !== true) return autoplay
513 513
514 const isIOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)
515 const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
516
517 // Giving up with iOS 514 // Giving up with iOS
518 if (isIOS) return false 515 if (isIOS()) return false
519 516
520 // We have issues with autoplay and Safari. 517 // We have issues with autoplay and Safari.
521 // any that tries to play using auto mute seems to work 518 // any that tries to play using auto mute seems to work
522 if (isSafari) return 'any' 519 if (isSafari()) return 'any'
523 520
524 return 'play' 521 return 'play'
525 } 522 }