+ seekStep: function (event: KeyboardEvent) {
+ // mimic VLC seek behavior, and default to 5 (original value is 5).
+ if (event.ctrlKey && event.altKey) {
+ return 5 * 60
+ } else if (event.ctrlKey) {
+ return 60
+ } else if (event.altKey) {
+ return 10
+ } else {
+ return 5
+ }
+ },
+
+ customKeys: {
+ increasePlaybackRateKey: {
+ key: function (event: KeyboardEvent) {
+ return event.key === '>'
+ },
+ handler: function (player: videojs.Player) {
+ const newValue = Math.min(player.playbackRate() + 0.1, 5)
+ player.playbackRate(parseFloat(newValue.toFixed(2)))
+ }
+ },
+ decreasePlaybackRateKey: {
+ key: function (event: KeyboardEvent) {
+ return event.key === '<'
+ },
+ handler: function (player: videojs.Player) {
+ const newValue = Math.max(player.playbackRate() - 0.1, 0.10)
+ player.playbackRate(parseFloat(newValue.toFixed(2)))
+ }
+ },
+ frameByFrame: {
+ key: function (event: KeyboardEvent) {
+ return event.key === '.'
+ },
+ handler: function (player: videojs.Player) {
+ player.pause()
+ // Calculate movement distance (assuming 30 fps)
+ const dist = 1 / 30
+ player.currentTime(player.currentTime() + dist)
+ }
+ }
+ }
+ }
+ })
+ }
+
+ private static getAutoPlayValue (autoplay: any) {
+ if (autoplay !== true) return autoplay
+
+ // We have issues with autoplay and Safari with webtorrent
+ if (isIOS()) {
+ // On first play, disable autoplay to avoid issues
+ // But if the player already played videos, we can safely autoplay next ones
+ return PeertubePlayerManager.alreadyPlayed ? 'play' : false
+ } else if (isSafari()) {
+ // Issues with Safari and webtorrent on first play
+ return PeertubePlayerManager.alreadyPlayed ? 'play' : false
+ }