From 63512d2596765e2316feb9be3bc0ead7586b2d7c Mon Sep 17 00:00:00 2001 From: Adrian Castro <22133246+castdrian@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:07:30 +0100 Subject: [PATCH 1/5] chore: add default fullscreen orientation value --- apps/expo/src/app/videoPlayer.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/expo/src/app/videoPlayer.tsx b/apps/expo/src/app/videoPlayer.tsx index c1baab4..9b7f561 100644 --- a/apps/expo/src/app/videoPlayer.tsx +++ b/apps/expo/src/app/videoPlayer.tsx @@ -148,6 +148,7 @@ const VideoPlayer: React.FC = ({ data }) => { // textTracks={textTracks} // breaks playback className="absolute inset-0" fullscreen={true} + fullscreenOrientation="landscape" paused={false} controls={true} onLoadStart={onVideoLoadStart} From 07096f0dec3943bceac222cd17dbd44595d8d1e7 Mon Sep 17 00:00:00 2001 From: Adrian Castro <22133246+castdrian@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:18:59 +0100 Subject: [PATCH 2/5] chore: prettier --- apps/expo/src/app/videoPlayer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/expo/src/app/videoPlayer.tsx b/apps/expo/src/app/videoPlayer.tsx index 9b7f561..bbe58bc 100644 --- a/apps/expo/src/app/videoPlayer.tsx +++ b/apps/expo/src/app/videoPlayer.tsx @@ -148,7 +148,7 @@ const VideoPlayer: React.FC = ({ data }) => { // textTracks={textTracks} // breaks playback className="absolute inset-0" fullscreen={true} - fullscreenOrientation="landscape" + fullscreenOrientation="landscape" paused={false} controls={true} onLoadStart={onVideoLoadStart} From 7483d6b973b87a8614ec9498506c20aee6981cb2 Mon Sep 17 00:00:00 2001 From: Adrian Castro <22133246+castdrian@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:31:42 +0100 Subject: [PATCH 3/5] fix: iOS only supports vtt captions --- apps/expo/app.config.ts | 2 +- apps/expo/src/app/videoPlayer.tsx | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/expo/app.config.ts b/apps/expo/app.config.ts index 7245d46..d03a74d 100644 --- a/apps/expo/app.config.ts +++ b/apps/expo/app.config.ts @@ -46,7 +46,7 @@ const defineConfig = (): ExpoConfig => ({ [ "expo-screen-orientation", { - initialOrientation: "DEFAULT", + initialOrientation: "PORTRAIT_UP", }, ], [ diff --git a/apps/expo/src/app/videoPlayer.tsx b/apps/expo/src/app/videoPlayer.tsx index bbe58bc..5450ad4 100644 --- a/apps/expo/src/app/videoPlayer.tsx +++ b/apps/expo/src/app/videoPlayer.tsx @@ -4,7 +4,7 @@ import type { TextTracks, } from "react-native-video"; import React, { useEffect, useState } from "react"; -import { ActivityIndicator, View } from "react-native"; +import { ActivityIndicator, Platform, View } from "react-native"; import Video, { TextTracksType } from "react-native-video"; import { useLocalSearchParams, useRouter } from "expo-router"; import * as ScreenOrientation from "expo-screen-orientation"; @@ -173,10 +173,16 @@ const captionTypeToTextTracksType = { }; function convertCaptionsToTextTracks(captions: Caption[]): TextTracks { - return captions.map((caption) => ({ - title: caption.language, - language: caption.language as ISO639_1, - type: captionTypeToTextTracksType[caption.type] || TextTracksType.VTT, - uri: caption.url, - })); + return captions.map((caption) => { + if (Platform.OS === "ios" && caption.type !== "vtt") { + return null; + } + + return { + title: caption.language, + language: caption.language as ISO639_1, + type: captionTypeToTextTracksType[caption.type], + uri: caption.url, + }; + }).filter(Boolean) as TextTracks; } From 51e24bec27259723ea9cd3f6ebc04299dbffafc5 Mon Sep 17 00:00:00 2001 From: Adrian Castro <22133246+castdrian@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:32:26 +0100 Subject: [PATCH 4/5] chore: prettier --- apps/expo/src/app/videoPlayer.tsx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/expo/src/app/videoPlayer.tsx b/apps/expo/src/app/videoPlayer.tsx index 5450ad4..fc9416e 100644 --- a/apps/expo/src/app/videoPlayer.tsx +++ b/apps/expo/src/app/videoPlayer.tsx @@ -173,16 +173,18 @@ const captionTypeToTextTracksType = { }; function convertCaptionsToTextTracks(captions: Caption[]): TextTracks { - return captions.map((caption) => { - if (Platform.OS === "ios" && caption.type !== "vtt") { - return null; - } + return captions + .map((caption) => { + if (Platform.OS === "ios" && caption.type !== "vtt") { + return null; + } - return { - title: caption.language, - language: caption.language as ISO639_1, - type: captionTypeToTextTracksType[caption.type], - uri: caption.url, - }; - }).filter(Boolean) as TextTracks; + return { + title: caption.language, + language: caption.language as ISO639_1, + type: captionTypeToTextTracksType[caption.type], + uri: caption.url, + }; + }) + .filter(Boolean) as TextTracks; } From b139a4a7ff64af08572b051ba51879c1585f28fd Mon Sep 17 00:00:00 2001 From: Adrian Castro <22133246+castdrian@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:40:31 +0100 Subject: [PATCH 5/5] chore: comment detail --- apps/expo/src/app/videoPlayer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/expo/src/app/videoPlayer.tsx b/apps/expo/src/app/videoPlayer.tsx index fc9416e..81811bb 100644 --- a/apps/expo/src/app/videoPlayer.tsx +++ b/apps/expo/src/app/videoPlayer.tsx @@ -145,7 +145,7 @@ const VideoPlayer: React.FC = ({ data }) => {