feat: audio track selector

This commit is contained in:
Adrian Castro
2024-02-23 10:08:26 +01:00
parent 410de846cd
commit 39d5acee77
3 changed files with 88 additions and 18 deletions

View File

@@ -50,10 +50,10 @@ jobs:
- name: Rename apk
run: cd apps/expo && mv android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/movie-web.apk
- name: Comment on pull request
uses: thollander/actions-comment-pull-request@v2
with:
filePath: ./apps/expo/android/app/build/outputs/apk/release/movie-web.apk
# - name: Comment on pull request
# uses: thollander/actions-comment-pull-request@v2
# with:
# filePath: ./apps/expo/android/app/build/outputs/apk/release/movie-web.apk
- name: Upload movie-web.apk as artifact
uses: actions/upload-artifact@v4
@@ -103,10 +103,10 @@ jobs:
cd ios/build/Build/Products/Release-iphoneos
zip -r ../../../movie-web.ipa Payload
- name: Comment on pull request
uses: thollander/actions-comment-pull-request@v2
with:
filePath: ./apps/expo/ios/build/movie-web.ipa
# - name: Comment on pull request
# uses: thollander/actions-comment-pull-request@v2
# with:
# filePath: ./apps/expo/ios/build/movie-web.ipa
- name: Upload movie-web.ipa as artifact
uses: actions/upload-artifact@v4

View File

@@ -46,11 +46,11 @@ jobs:
- name: Rename apk
run: cd apps/expo && mv android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/movie-web.apk
- name: Comment on pull request
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: ./apps/expo/android/app/build/outputs/apk/release/movie-web.apk
# - name: Comment on pull request
# if: github.event_name == 'pull_request'
# uses: thollander/actions-comment-pull-request@v2
# with:
# filePath: ./apps/expo/android/app/build/outputs/apk/release/movie-web.apk
- name: Upload movie-web.apk as artifact
uses: actions/upload-artifact@v4
@@ -95,11 +95,11 @@ jobs:
cd ios/build/Build/Products/Release-iphoneos
zip -r ../../../movie-web.ipa Payload
- name: Comment on pull request
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: ./apps/expo/ios/build/movie-web.ipa
# - name: Comment on pull request
# if: github.event_name == 'pull_request'
# uses: thollander/actions-comment-pull-request@v2
# with:
# filePath: ./apps/expo/ios/build/movie-web.ipa
- name: Upload movie-web.ipa as artifact
uses: actions/upload-artifact@v4

View File

@@ -0,0 +1,70 @@
import { Pressable, ScrollView, View } from "react-native";
import Modal from "react-native-modal";
import { MaterialCommunityIcons } from "@expo/vector-icons";
import colors from "@movie-web/tailwind-config/colors";
import { useBoolean } from "~/hooks/useBoolean";
import { useAudioTrackStore } from "~/stores/audio";
import { usePlayerStore } from "~/stores/player/store";
import { Button } from "../ui/Button";
import { Text } from "../ui/Text";
import { Controls } from "./Controls";
export const CaptionsSelector = () => {
const tracks = usePlayerStore((state) => state.interface.audioTracks);
const setSelectedAudioTrack = useAudioTrackStore(
(state) => state.setSelectedAudioTrack,
);
const { isTrue, on, off } = useBoolean();
if (!tracks?.length) return null;
return (
<View className="max-w-36 flex-1">
<Controls>
<Button
title="Audio"
variant="outline"
onPress={on}
iconLeft={
<MaterialCommunityIcons
name="volume-high"
size={24}
color={colors.primary[300]}
/>
}
/>
</Controls>
<Modal
isVisible={isTrue}
onBackdropPress={off}
supportedOrientations={["portrait", "landscape"]}
style={{
width: "35%",
justifyContent: "center",
alignSelf: "center",
}}
>
<ScrollView className="flex-1 bg-gray-900">
<Text className="text-center font-bold">Select audio</Text>
{tracks?.map((track) => (
<Pressable
className="flex w-full flex-row justify-between p-3"
key={track.language}
onPress={() => {
setSelectedAudioTrack(track);
off();
}}
>
<Text>{track.name}</Text>
</Pressable>
))}
</ScrollView>
</Modal>
</View>
);
};