@draftbit/core 54.0.4-6c949a.2 → 54.0.4-982952.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +1 -1
- package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +1 -1
- package/lib/commonjs/components/Layout/Spacer.js +1 -1
- package/lib/commonjs/components/LottieAnimation.js +1 -1
- package/lib/commonjs/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js +1 -1
- package/lib/commonjs/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.js +1 -1
- package/lib/commonjs/components/MediaPlayer/MediaPlaybackWrapper.js +1 -1
- package/lib/commonjs/components/MediaPlayer/MediaPlayerCommon.js +1 -1
- package/lib/commonjs/components/MediaPlayer/VideoPlayer/VideoPlayer.js +1 -1
- package/lib/commonjs/components/Picker/PickerInputContainer.js +1 -1
- package/lib/commonjs/components/Progress/CircularProgress/CircularProgress.js +1 -1
- package/lib/commonjs/components/Progress/LinearProgress/LinearProgress.js +1 -1
- package/lib/commonjs/components/SVG.js +1 -1
- package/lib/commonjs/components/SVG.native.js +1 -1
- package/lib/commonjs/components/SectionList/SectionHeader.js +1 -1
- package/lib/commonjs/components/SwipeableItem/SwipeableItem.js +1 -1
- package/lib/commonjs/components/Swiper/Swiper.js +1 -1
- package/lib/commonjs/components/Swiper/SwiperItem.js +1 -1
- package/lib/commonjs/components/Table/TableCell.js +1 -1
- package/lib/commonjs/components/Table/TableRow.js +1 -1
- package/lib/commonjs/components/YoutubePlayer/YoutubePlayer.js +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +1 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.js +3 -2
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.js.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +2 -2
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.js +3 -3
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.js.map +1 -1
- package/lib/typescript/src/components/Layout/Spacer.d.ts +2 -2
- package/lib/typescript/src/components/Layout/Spacer.js +2 -2
- package/lib/typescript/src/components/Layout/Spacer.js.map +1 -1
- package/lib/typescript/src/components/LottieAnimation.js +2 -2
- package/lib/typescript/src/components/LottieAnimation.js.map +1 -1
- package/lib/typescript/src/components/MediaPlayer/AudioPlayer/AudioPlayerCommon.d.ts +1 -0
- package/lib/typescript/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js +4 -2
- package/lib/typescript/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js.map +1 -1
- package/lib/typescript/src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.d.ts +3 -1
- package/lib/typescript/src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.js +69 -54
- package/lib/typescript/src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.js.map +1 -1
- package/lib/typescript/src/components/MediaPlayer/MediaPlaybackWrapper.d.ts +3 -2
- package/lib/typescript/src/components/MediaPlayer/MediaPlaybackWrapper.js +19 -21
- package/lib/typescript/src/components/MediaPlayer/MediaPlaybackWrapper.js.map +1 -1
- package/lib/typescript/src/components/MediaPlayer/MediaPlayerCommon.d.ts +5 -4
- package/lib/typescript/src/components/MediaPlayer/MediaPlayerCommon.js +3 -26
- package/lib/typescript/src/components/MediaPlayer/MediaPlayerCommon.js.map +1 -1
- package/lib/typescript/src/components/MediaPlayer/VideoPlayer/VideoPlayer.d.ts +14 -4
- package/lib/typescript/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js +129 -62
- package/lib/typescript/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js.map +1 -1
- package/lib/typescript/src/components/Picker/PickerCommon.d.ts +1 -0
- package/lib/typescript/src/components/Picker/PickerCommon.js.map +1 -1
- package/lib/typescript/src/components/Picker/PickerInputContainer.js +4 -2
- package/lib/typescript/src/components/Picker/PickerInputContainer.js.map +1 -1
- package/lib/typescript/src/components/Progress/CircularProgress/CircularProgress.js +4 -2
- package/lib/typescript/src/components/Progress/CircularProgress/CircularProgress.js.map +1 -1
- package/lib/typescript/src/components/Progress/LinearProgress/LinearProgress.js +4 -2
- package/lib/typescript/src/components/Progress/LinearProgress/LinearProgress.js.map +1 -1
- package/lib/typescript/src/components/Progress/ProgressCommon.d.ts +1 -0
- package/lib/typescript/src/components/SVG.d.ts +1 -0
- package/lib/typescript/src/components/SVG.js +4 -2
- package/lib/typescript/src/components/SVG.js.map +1 -1
- package/lib/typescript/src/components/SVG.native.d.ts +1 -0
- package/lib/typescript/src/components/SVG.native.js +4 -2
- package/lib/typescript/src/components/SVG.native.js.map +1 -1
- package/lib/typescript/src/components/SectionList/SectionHeader.d.ts +2 -2
- package/lib/typescript/src/components/SectionList/SectionHeader.js +1 -1
- package/lib/typescript/src/components/SectionList/SectionHeader.js.map +1 -1
- package/lib/typescript/src/components/SwipeableItem/SwipeableItem.d.ts +1 -0
- package/lib/typescript/src/components/SwipeableItem/SwipeableItem.js +4 -2
- package/lib/typescript/src/components/SwipeableItem/SwipeableItem.js.map +1 -1
- package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -2
- package/lib/typescript/src/components/Swiper/Swiper.js +2 -2
- package/lib/typescript/src/components/Swiper/Swiper.js.map +1 -1
- package/lib/typescript/src/components/Swiper/SwiperItem.d.ts +3 -3
- package/lib/typescript/src/components/Swiper/SwiperItem.js +2 -2
- package/lib/typescript/src/components/Swiper/SwiperItem.js.map +1 -1
- package/lib/typescript/src/components/Table/TableCell.d.ts +1 -0
- package/lib/typescript/src/components/Table/TableCell.js +4 -2
- package/lib/typescript/src/components/Table/TableCell.js.map +1 -1
- package/lib/typescript/src/components/Table/TableRow.d.ts +1 -0
- package/lib/typescript/src/components/Table/TableRow.js +4 -2
- package/lib/typescript/src/components/Table/TableRow.js.map +1 -1
- package/lib/typescript/src/components/YoutubePlayer/YoutubePlayer.js +2 -2
- package/lib/typescript/src/components/YoutubePlayer/YoutubePlayer.js.map +1 -1
- package/lib/typescript/src/components/YoutubePlayer/YoutubePlayerProps.d.ts +1 -0
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/components/DeckSwiper/DeckSwiper.tsx +5 -1
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +11 -3
- package/src/components/Layout/Spacer.tsx +4 -2
- package/src/components/LottieAnimation.tsx +1 -2
- package/src/components/MediaPlayer/AudioPlayer/AudioPlayerCommon.ts +1 -0
- package/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.tsx +3 -0
- package/src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.tsx +84 -72
- package/src/components/MediaPlayer/MediaPlaybackWrapper.tsx +21 -24
- package/src/components/MediaPlayer/MediaPlayerCommon.ts +8 -34
- package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.tsx +220 -86
- package/src/components/Picker/PickerCommon.ts +1 -0
- package/src/components/Picker/PickerInputContainer.tsx +7 -1
- package/src/components/Progress/CircularProgress/CircularProgress.tsx +3 -0
- package/src/components/Progress/LinearProgress/LinearProgress.tsx +3 -0
- package/src/components/Progress/ProgressCommon.ts +1 -0
- package/src/components/SVG.native.tsx +7 -1
- package/src/components/SVG.tsx +10 -1
- package/src/components/SectionList/SectionHeader.tsx +8 -3
- package/src/components/SwipeableItem/SwipeableItem.tsx +4 -0
- package/src/components/Swiper/Swiper.tsx +4 -3
- package/src/components/Swiper/SwiperItem.tsx +12 -4
- package/src/components/Table/TableCell.tsx +4 -0
- package/src/components/Table/TableRow.tsx +4 -0
- package/src/components/YoutubePlayer/YoutubePlayer.tsx +5 -1
- package/src/components/YoutubePlayer/YoutubePlayerProps.ts +1 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
2
|
+
import { View, StyleSheet, } from "react-native";
|
|
3
3
|
import { withTheme } from "@draftbit/theme";
|
|
4
|
-
const DeckSwiperCard = ({ style, children, theme }) => (React.createElement(View, { style: [
|
|
4
|
+
const DeckSwiperCard = ({ style, children, theme, ...rest }) => (React.createElement(View, { style: [
|
|
5
5
|
styles.card,
|
|
6
6
|
{
|
|
7
7
|
backgroundColor: theme.colors.background.base,
|
|
8
8
|
borderColor: theme.colors.border.base,
|
|
9
9
|
},
|
|
10
10
|
style,
|
|
11
|
-
] }, children));
|
|
11
|
+
], ...rest }, children));
|
|
12
12
|
const styles = StyleSheet.create({
|
|
13
13
|
card: {
|
|
14
14
|
alignItems: "center",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeckSwiperCard.js","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"DeckSwiperCard.js","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,IAAI,EAEJ,UAAU,GAGX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,cAAc,GAEhB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CAC3C,oBAAC,IAAI,IACH,KAAK,EAAE;QACL,MAAM,CAAC,IAAI;QACX;YACE,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI;YAC7C,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;SACtC;QACD,KAAK;KACN,KACG,IAAI,IAEP,QAAQ,CACJ,CACR,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAC;KACf;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
interface SpacerProps {
|
|
2
|
+
import { ViewProps, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
interface SpacerProps extends Omit<ViewProps, "style"> {
|
|
4
4
|
top?: number;
|
|
5
5
|
right?: number;
|
|
6
6
|
left?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
const Spacer = ({ top = 8, right = 8, bottom = 8, left = 8, style, }) => {
|
|
3
|
+
const Spacer = ({ top = 8, right = 8, bottom = 8, left = 8, style, ...rest }) => {
|
|
4
4
|
return (React.createElement(View, { style: [
|
|
5
5
|
style,
|
|
6
6
|
{
|
|
@@ -9,7 +9,7 @@ const Spacer = ({ top = 8, right = 8, bottom = 8, left = 8, style, }) => {
|
|
|
9
9
|
paddingLeft: left,
|
|
10
10
|
paddingBottom: bottom,
|
|
11
11
|
},
|
|
12
|
-
] }));
|
|
12
|
+
], ...rest }));
|
|
13
13
|
};
|
|
14
14
|
export default Spacer;
|
|
15
15
|
//# sourceMappingURL=Spacer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spacer.js","sourceRoot":"","sources":["../../../../../src/components/Layout/Spacer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"Spacer.js","sourceRoot":"","sources":["../../../../../src/components/Layout/Spacer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAmC,MAAM,cAAc,CAAC;AAUrE,MAAM,MAAM,GAA0B,CAAC,EACrC,GAAG,GAAG,CAAC,EACP,KAAK,GAAG,CAAC,EACT,MAAM,GAAG,CAAC,EACV,IAAI,GAAG,CAAC,EACR,KAAK,EACL,GAAG,IAAI,EACR,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,IAAI,IACH,KAAK,EAAE;YACL,KAAK;YACL;gBACE,YAAY,EAAE,KAAK;gBACnB,UAAU,EAAE,GAAG;gBACf,WAAW,EAAE,IAAI;gBACjB,aAAa,EAAE,MAAM;aACtB;SACF,KACG,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -2,11 +2,11 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import LottieView from "lottie-react-native";
|
|
4
4
|
const LottieAnimation = forwardRef(({ style, source, autoPlay = true, loop = true, resizeMode = "cover", speed = 1, ...rest }, ref) => {
|
|
5
|
-
return (React.createElement(View, { style: style },
|
|
5
|
+
return (React.createElement(View, { style: style, ...rest },
|
|
6
6
|
React.createElement(LottieView, { ref: ref, source: source, autoPlay: autoPlay, loop: loop, resizeMode: resizeMode, speed: speed,
|
|
7
7
|
// A specific size is required on mobile, but not on web.
|
|
8
8
|
// This ensures consistent behavior across platforms during preview.
|
|
9
|
-
style: { width: "100%", height: "100%" }
|
|
9
|
+
style: { width: "100%", height: "100%" } })));
|
|
10
10
|
});
|
|
11
11
|
export default LottieAnimation;
|
|
12
12
|
//# sourceMappingURL=LottieAnimation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LottieAnimation.js","sourceRoot":"","sources":["../../../../src/components/LottieAnimation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAwB,MAAM,cAAc,CAAC;AAC1D,OAAO,UAA+B,MAAM,qBAAqB,CAAC;AAWlE,MAAM,eAAe,GAAG,UAAU,CAChC,CACE,EACE,KAAK,EACL,MAAM,EACN,QAAQ,GAAG,IAAI,EACf,IAAI,GAAG,IAAI,EACX,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,CAAC,EACT,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,OAAO,CACL,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"LottieAnimation.js","sourceRoot":"","sources":["../../../../src/components/LottieAnimation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAwB,MAAM,cAAc,CAAC;AAC1D,OAAO,UAA+B,MAAM,qBAAqB,CAAC;AAWlE,MAAM,eAAe,GAAG,UAAU,CAChC,CACE,EACE,KAAK,EACL,MAAM,EACN,QAAQ,GAAG,IAAI,EACf,IAAI,GAAG,IAAI,EACX,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,CAAC,EACT,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,OAAO,CACL,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,KAAM,IAAI;QAC1B,oBAAC,UAAU,IACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK;YACZ,yDAAyD;YACzD,oEAAoE;YACpE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GACxC,CACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -10,6 +10,7 @@ export interface HeadlessAudioPlayerProps extends MediaPlayerProps {
|
|
|
10
10
|
volume?: number;
|
|
11
11
|
}
|
|
12
12
|
export interface AudioPlayerInterfaceProps {
|
|
13
|
+
className?: string;
|
|
13
14
|
style?: StyleProp<ViewStyle & TextStyle>;
|
|
14
15
|
thumbColor?: string;
|
|
15
16
|
completedTrackColor?: string;
|
|
@@ -8,7 +8,7 @@ import Pressable from "../../Pressable";
|
|
|
8
8
|
/**
|
|
9
9
|
* Built on top of HeadlessAudioPlayer to provide a simple interface for playing audio
|
|
10
10
|
*/
|
|
11
|
-
const AudioPlayerWithInterface = React.forwardRef(({ style, thumbColor, completedTrackColor, remainingTrackColor, togglePlaybackIconSize = 24, togglePlaybackIconColor, onPlaybackStatusUpdate: onPlaybackStatusUpdateProp, onPlaybackFinish: onPlaybackFinishProp, hidePlaybackIcon = false, hideDuration = false, hideSlider = false, ...rest }, ref) => {
|
|
11
|
+
const AudioPlayerWithInterface = React.forwardRef(({ style, className, thumbColor, completedTrackColor, remainingTrackColor, togglePlaybackIconSize = 24, togglePlaybackIconColor, onPlaybackStatusUpdate: onPlaybackStatusUpdateProp, onPlaybackFinish: onPlaybackFinishProp, hidePlaybackIcon = false, hideDuration = false, hideSlider = false, ...rest }, ref) => {
|
|
12
12
|
const [isPlaying, setIsPlaying] = React.useState(false);
|
|
13
13
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
14
14
|
const [durationMillis, setDurationMillis] = React.useState(1);
|
|
@@ -73,7 +73,9 @@ const AudioPlayerWithInterface = React.forwardRef(({ style, thumbColor, complete
|
|
|
73
73
|
}
|
|
74
74
|
return (React.createElement(React.Fragment, null,
|
|
75
75
|
React.createElement(HeadlessAudioPlayer, { ...rest, ref: headlessAudioPlayerRef, onPlaybackStatusUpdate: onPlaybackStatusUpdate, onPlaybackFinish: onPlaybackFinish }),
|
|
76
|
-
React.createElement(View, { testID: "audio-player-interface",
|
|
76
|
+
React.createElement(View, { testID: "audio-player-interface",
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
className: className, style: [
|
|
77
79
|
{
|
|
78
80
|
backgroundColor: theme.colors.background.base,
|
|
79
81
|
borderColor: theme.colors.border.base,
|
package/lib/typescript/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioPlayerWithInterface.js","sourceRoot":"","sources":["../../../../../../src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,MAAM,MAAM,gCAAgC,CAAC;AACpD,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAKxD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAGxC;;GAEG;AACH,MAAM,wBAAwB,GAAG,KAAK,CAAC,UAAU,CAI/C,CACE,EACE,KAAK,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GAAG,EAAE,EAC3B,uBAAuB,EACvB,sBAAsB,EAAE,0BAA0B,EAClD,gBAAgB,EAAE,oBAAoB,EACtC,gBAAgB,GAAG,KAAK,EACxB,YAAY,GAAG,KAAK,EACpB,UAAU,GAAG,KAAK,EAClB,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAExD,CAAC,CAAC,CAAC;IACL,MAAM,CAAC,gBAAgB,E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AC,KAAK,CAAC,CAAC;QACpB,uBAAuB,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAA,sBAAsB,CAAC,OAAO,0CAAE,cAAc,EAAE,CAAC;QACjD,MAAA,sBAAsB,CAAC,OAAO,0CAAE,cAAc,CAAC,CAAC,CAAC,CAAC;QAClD,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,EAAI,CAAC;IAC3B,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAE,EAAE;;QAChD,IAAI,gBAAgB,EAAE,CAAC;YACrB,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,MAAA,sBAAsB,CAAC,OAAO,0CAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,QAAQ,CAAC;IACb,IAAI,SAAS,EAAE,CAAC;QACd,QAAQ,GAAG,SAAS,CAAC;IACvB,CAAC;SAAM,IAAI,SAAS,EAAE,CAAC;QACrB,QAAQ,GAAG,OAAO,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,aAAa,CAAC;IAC3B,CAAC;IAED,OAAO,CACL;QACE,oBAAC,mBAAmB,OACd,IAAI,EACR,GAAG,EAAE,sBAAsB,EAC3B,sBAAsB,EAAE,sBAAsB,EAC9C,gBAAgB,EAAE,gBAAgB,GAClC;QACF,oBAAC,IAAI,IACH,MAAM,EAAC,wBAAwB
|
|
1
|
+
{"version":3,"file":"AudioPlayerWithInterface.js","sourceRoot":"","sources":["../../../../../../src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,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aPlayerRef } from "../MediaPlayerCommon";
|
|
4
|
+
import type { MediaPlayerRef, MediaPlayerStatus } from "../MediaPlayerCommon";
|
|
4
5
|
/**
|
|
5
6
|
* Audio Player component without an interface (UI).
|
|
6
7
|
* Only handles playing of the audio and provides callbacks and ref functions
|
|
7
8
|
*/
|
|
8
9
|
declare const HeadlessAudioPlayer: React.ForwardRefExoticComponent<HeadlessAudioPlayerProps & React.RefAttributes<MediaPlayerRef>>;
|
|
10
|
+
export declare function mapToMediaPlayerStatus(status: AudioStatus): MediaPlayerStatus;
|
|
9
11
|
export default HeadlessAudioPlayer;
|
|
@@ -1,37 +1,62 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useAudioPlayer, setAudioModeAsync } from "expo-audio";
|
|
3
|
+
import { normalizeBase64Source, useSourceDeepCompareMemoize, useSourceDeepCompareEffect, } from "../MediaPlayerCommon";
|
|
4
4
|
import MediaPlaybackWrapper from "../MediaPlaybackWrapper";
|
|
5
5
|
/**
|
|
6
6
|
* Audio Player component without an interface (UI).
|
|
7
7
|
* Only handles playing of the audio and provides callbacks and ref functions
|
|
8
8
|
*/
|
|
9
9
|
const HeadlessAudioPlayer = React.forwardRef(({ source, interruptionMode = "lower volume", playsInBackground = false, playsInSilentModeIOS = false, playThroughEarpieceAndroid = false, onPlaybackStatusUpdate: onPlaybackStatusUpdateProp, onPlaybackFinish, isLooping = false, volume = 1.0, }, ref) => {
|
|
10
|
-
const
|
|
10
|
+
const stableSource = useSourceDeepCompareMemoize(normalizeBase64Source(source, "audio"));
|
|
11
|
+
const player = useAudioPlayer(stableSource);
|
|
11
12
|
const [isPlaying, setIsPlaying] = React.useState(false);
|
|
12
13
|
React.useEffect(() => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, [
|
|
14
|
+
player.loop = isLooping;
|
|
15
|
+
}, [player, isLooping]);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
player.volume = volume;
|
|
18
|
+
}, [player, volume]);
|
|
19
|
+
// Emit loading state immediately
|
|
18
20
|
React.useEffect(() => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
onPlaybackStatusUpdateProp === null || onPlaybackStatusUpdateProp === void 0 ? void 0 : onPlaybackStatusUpdateProp({
|
|
22
|
+
isPlaying: false,
|
|
23
|
+
isLoading: true,
|
|
24
|
+
isBuffering: false,
|
|
25
|
+
currentPositionMillis: 0,
|
|
26
|
+
durationMillis: 0,
|
|
27
|
+
bufferedDurationMillis: 0,
|
|
28
|
+
isError: false,
|
|
29
|
+
});
|
|
30
|
+
}, []);
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
const subscription = player.addListener("playbackStatusUpdate", (status) => {
|
|
33
|
+
const mappedStatus = mapToMediaPlayerStatus(status);
|
|
34
|
+
onPlaybackStatusUpdateProp === null || onPlaybackStatusUpdateProp === void 0 ? void 0 : onPlaybackStatusUpdateProp(mappedStatus);
|
|
35
|
+
if (status.isLoaded) {
|
|
36
|
+
if (status.didJustFinish && !isLooping) {
|
|
37
|
+
onPlaybackFinish === null || onPlaybackFinish === void 0 ? void 0 : onPlaybackFinish();
|
|
38
|
+
}
|
|
39
|
+
setIsPlaying(status.playing);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return () => subscription.remove();
|
|
43
|
+
}, []);
|
|
44
|
+
// Replace source when it changes (deep comparison on URI to avoid unnecessary reloads)
|
|
45
|
+
const isFirstSourceRender = React.useRef(true);
|
|
46
|
+
useSourceDeepCompareEffect(() => {
|
|
47
|
+
if (isFirstSourceRender.current) {
|
|
48
|
+
isFirstSourceRender.current = false;
|
|
49
|
+
return;
|
|
21
50
|
}
|
|
22
|
-
|
|
51
|
+
player.replace(normalizeBase64Source(source, "audio"));
|
|
52
|
+
}, [source]);
|
|
23
53
|
const updateAudioMode = React.useCallback(async () => {
|
|
24
54
|
try {
|
|
25
|
-
await
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
interruptionModeAndroid: interruptionMode === "lower volume"
|
|
31
|
-
? InterruptionModeAndroid.DuckOthers
|
|
32
|
-
: InterruptionModeAndroid.DoNotMix,
|
|
33
|
-
playsInSilentModeIOS,
|
|
34
|
-
playThroughEarpieceAndroid,
|
|
55
|
+
await setAudioModeAsync({
|
|
56
|
+
shouldPlayInBackground: playsInBackground,
|
|
57
|
+
interruptionMode: interruptionMode === "lower volume" ? "duckOthers" : "doNotMix",
|
|
58
|
+
playsInSilentMode: playsInSilentModeIOS,
|
|
59
|
+
shouldRouteThroughEarpiece: playThroughEarpieceAndroid,
|
|
35
60
|
});
|
|
36
61
|
}
|
|
37
62
|
catch (e) {
|
|
@@ -48,43 +73,33 @@ const HeadlessAudioPlayer = React.forwardRef(({ source, interruptionMode = "lowe
|
|
|
48
73
|
playsInSilentModeIOS,
|
|
49
74
|
playThroughEarpieceAndroid,
|
|
50
75
|
]);
|
|
51
|
-
const onPlaybackStatusUpdate = (status) => {
|
|
52
|
-
const mappedStatus = mapToMediaPlayerStatus(status);
|
|
53
|
-
onPlaybackStatusUpdateProp === null || onPlaybackStatusUpdateProp === void 0 ? void 0 : onPlaybackStatusUpdateProp(mappedStatus);
|
|
54
|
-
if (status.isLoaded) {
|
|
55
|
-
if (status.didJustFinish) {
|
|
56
|
-
if (isLooping) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
onPlaybackFinish === null || onPlaybackFinish === void 0 ? void 0 : onPlaybackFinish();
|
|
60
|
-
}
|
|
61
|
-
setIsPlaying(status.isPlaying);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
76
|
const onTogglePlayback = () => {
|
|
65
|
-
//Has to be called everytime a player is played to reconfigure the global Audio config based on each player's configuration
|
|
77
|
+
// Has to be called everytime a player is played to reconfigure the global Audio config based on each player's configuration
|
|
66
78
|
updateAudioMode();
|
|
67
79
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
return (React.createElement(MediaPlaybackWrapper, { ref: ref, isPlaying: isPlaying, player: player, onTogglePlayback: onTogglePlayback }));
|
|
81
|
+
});
|
|
82
|
+
export function mapToMediaPlayerStatus(status) {
|
|
83
|
+
if (status.isLoaded) {
|
|
84
|
+
return {
|
|
85
|
+
isPlaying: status.playing,
|
|
86
|
+
isLoading: false,
|
|
87
|
+
isBuffering: status.isBuffering,
|
|
88
|
+
currentPositionMillis: status.currentTime * 1000,
|
|
89
|
+
durationMillis: status.duration * 1000,
|
|
90
|
+
bufferedDurationMillis: status.duration * 1000,
|
|
76
91
|
isError: false,
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
isPlaying: false,
|
|
96
|
+
isLoading: true,
|
|
97
|
+
isBuffering: false,
|
|
98
|
+
currentPositionMillis: 0,
|
|
99
|
+
durationMillis: 0,
|
|
100
|
+
bufferedDurationMillis: 0,
|
|
101
|
+
isError: false,
|
|
82
102
|
};
|
|
83
|
-
|
|
84
|
-
loadAudio();
|
|
85
|
-
// Ignore dependency of loadAudio
|
|
86
|
-
}, [source]);
|
|
87
|
-
return (React.createElement(MediaPlaybackWrapper, { ref: ref, isPlaying: isPlaying, media: currentSound, onTogglePlayback: onTogglePlayback }));
|
|
88
|
-
});
|
|
103
|
+
}
|
|
89
104
|
export default HeadlessAudioPlayer;
|
|
90
105
|
//# sourceMappingURL=HeadlessAudioPlayer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadlessAudioPlayer.js","sourceRoot":"","sources":["../../../../../../src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"HeadlessAudioPlayer.js","sourceRoot":"","sources":["../../../../../../src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAe,MAAM,YAAY,CAAC;AAE5E,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D;;;GAGG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAI1C,CACE,EACE,MAAM,EACN,gBAAgB,GAAG,cAAc,EACjC,iBAAiB,GAAG,KAAK,EACzB,oBAAoB,GAAG,KAAK,EAC5B,0BAA0B,GAAG,KAAK,EAClC,sBAAsB,EAAE,0BAA0B,EAClD,gBAAgB,EAChB,SAAS,GAAG,KAAK,EACjB,MAAM,GAAG,GAAG,GACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,YAAY,GAAG,2BAA2B,CAC9C,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,CACvC,CAAC;IACF,MAAM,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;IAE5C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;IAC1B,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAExB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAErB,iCAAiC;IACjC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QAC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AE,MAAM,CAAC,QAAQ,GAAG,IAAI;YACtC,sBAAsB,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI;YAC9C,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAED,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,KAAK;QAClB,qBAAqB,EAAE,CAAC;QACxB,cAAc,EAAE,CAAC;QACjB,sBAAsB,EAAE,CAAC;QACzB,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AudioPlayer } from "expo-audio";
|
|
3
|
+
import type { VideoPlayer } from "expo-video";
|
|
3
4
|
import type { MediaPlayerRef } from "./MediaPlayerCommon";
|
|
4
5
|
interface MediaPlaybackWrapperProps {
|
|
5
|
-
|
|
6
|
+
player?: AudioPlayer | VideoPlayer;
|
|
6
7
|
isPlaying?: boolean;
|
|
7
8
|
onTogglePlayback?: () => void;
|
|
8
9
|
}
|
|
@@ -2,34 +2,32 @@ import * as React from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* Wrapper component that handles common media playback operations that is reusable with audio and video players
|
|
4
4
|
*/
|
|
5
|
-
const MediaPlaybackWrapper = React.forwardRef(({
|
|
6
|
-
const togglePlayback = React.useCallback(
|
|
5
|
+
const MediaPlaybackWrapper = React.forwardRef(({ player, isPlaying, onTogglePlayback, children }, ref) => {
|
|
6
|
+
const togglePlayback = React.useCallback(() => {
|
|
7
7
|
onTogglePlayback === null || onTogglePlayback === void 0 ? void 0 : onTogglePlayback();
|
|
8
8
|
if (isPlaying) {
|
|
9
|
-
|
|
9
|
+
player === null || player === void 0 ? void 0 : player.pause();
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
|
-
|
|
12
|
+
player === null || player === void 0 ? void 0 : player.play();
|
|
13
13
|
}
|
|
14
|
-
}, [
|
|
15
|
-
const pause = React.useCallback(
|
|
14
|
+
}, [isPlaying, onTogglePlayback]);
|
|
15
|
+
const pause = React.useCallback(() => {
|
|
16
16
|
onTogglePlayback === null || onTogglePlayback === void 0 ? void 0 : onTogglePlayback();
|
|
17
|
-
|
|
18
|
-
}, [
|
|
19
|
-
const play = React.useCallback(
|
|
17
|
+
player === null || player === void 0 ? void 0 : player.pause();
|
|
18
|
+
}, [player, onTogglePlayback]);
|
|
19
|
+
const play = React.useCallback(() => {
|
|
20
20
|
onTogglePlayback === null || onTogglePlayback === void 0 ? void 0 : onTogglePlayback();
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
const seekToPosition = React.useCallback(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
: undefined;
|
|
32
|
-
}, [media]);
|
|
21
|
+
player === null || player === void 0 ? void 0 : player.play();
|
|
22
|
+
}, [player, onTogglePlayback]);
|
|
23
|
+
const seekToPosition = React.useCallback((positionMillis) => {
|
|
24
|
+
if (typeof (player === null || player === void 0 ? void 0 : player.seekTo) === "function") {
|
|
25
|
+
player.seekTo(positionMillis / 1000);
|
|
26
|
+
}
|
|
27
|
+
else if (player) {
|
|
28
|
+
player.currentTime = positionMillis / 1000;
|
|
29
|
+
}
|
|
30
|
+
}, [player]);
|
|
33
31
|
React.useImperativeHandle(ref, () => ({
|
|
34
32
|
seekToPosition,
|
|
35
33
|
togglePlayback,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaPlaybackWrapper.js","sourceRoot":"","sources":["../../../../../src/components/MediaPlayer/MediaPlaybackWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MediaPlaybackWrapper.js","sourceRoot":"","sources":["../../../../../src/components/MediaPlayer/MediaPlaybackWrapper.tsx"],"names":[],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ACjD,MAAsB,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;QACxD,CAAC;aAAM,IAAI,MAAM,EAAE,CAAC;YAClB,MAAM,CAAC,WAAW,GAAG,cAAc,GAAG,IAAI,CAAC;QAC7C,CAAC;IACH,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,KAAK,CAAC,mBAAmB,CACvB,GAAG,EACH,GAAG,EAAE,CAAC,CAAC;QACL,cAAc;QACd,cAAc;QACd,KAAK;QACL,IAAI;KACL,CAAC,EACF,CAAC,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,CAAC,CAC9C,CAAC;IAEF,OAAO,0CAAG,QAAQ,CAAI,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AudioSource } from "expo-audio";
|
|
2
|
+
import { VideoSource } from "expo-video";
|
|
2
3
|
import React from "react";
|
|
3
4
|
export interface MediaPlayerStatus {
|
|
4
5
|
isPlaying: boolean;
|
|
@@ -19,11 +20,11 @@ export interface MediaPlayerRef {
|
|
|
19
20
|
export interface MediaPlayerProps {
|
|
20
21
|
onPlaybackStatusUpdate?: (status: MediaPlayerStatus) => void;
|
|
21
22
|
onPlaybackFinish?: () => void;
|
|
22
|
-
source:
|
|
23
|
+
source: AudioSource | VideoSource;
|
|
23
24
|
}
|
|
24
|
-
export declare function mapToMediaPlayerStatus(status: AVPlaybackStatus): MediaPlayerStatus;
|
|
25
25
|
/**
|
|
26
26
|
* Base64 strings are not playable on iOS and needs to be saved to a file before playing
|
|
27
27
|
*/
|
|
28
|
-
export declare function normalizeBase64Source(source:
|
|
28
|
+
export declare function normalizeBase64Source(source: AudioSource | VideoSource, type: "audio" | "video"): AudioSource | VideoSource;
|
|
29
|
+
export declare function useSourceDeepCompareMemoize(value: any): any;
|
|
29
30
|
export declare function useSourceDeepCompareEffect(callback: React.EffectCallback, dependencies: React.DependencyList): void;
|
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
import { v4 as uuid } from "uuid";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
3
|
import React from "react";
|
|
4
|
-
export function mapToMediaPlayerStatus(status) {
|
|
5
|
-
if (status.isLoaded) {
|
|
6
|
-
return {
|
|
7
|
-
isPlaying: status.isPlaying,
|
|
8
|
-
isLoading: false,
|
|
9
|
-
isBuffering: status.isBuffering,
|
|
10
|
-
currentPositionMillis: status.positionMillis || 0,
|
|
11
|
-
durationMillis: status.durationMillis || 0,
|
|
12
|
-
bufferedDurationMillis: status.playableDurationMillis || 0,
|
|
13
|
-
isError: false,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
isPlaying: false,
|
|
18
|
-
isLoading: false,
|
|
19
|
-
isBuffering: false,
|
|
20
|
-
currentPositionMillis: 0,
|
|
21
|
-
durationMillis: 0,
|
|
22
|
-
bufferedDurationMillis: 0,
|
|
23
|
-
isError: true,
|
|
24
|
-
error: status.error,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
4
|
const URL_REGEX = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
|
|
28
5
|
/**
|
|
29
6
|
* Base64 strings are not playable on iOS and needs to be saved to a file before playing
|
|
30
7
|
*/
|
|
31
|
-
export
|
|
8
|
+
export function normalizeBase64Source(source, type) {
|
|
32
9
|
const uri = source === null || source === void 0 ? void 0 : source.uri;
|
|
33
10
|
if (Platform.OS === "ios" && uri && !uri.match(URL_REGEX)) {
|
|
34
|
-
const { File, Paths } =
|
|
11
|
+
const { File, Paths } = require("expo-file-system");
|
|
35
12
|
const defaultMimeType = type === "audio" ? "wav" : "mp4";
|
|
36
13
|
const mimeType = uri.startsWith(`data:${type}/`)
|
|
37
14
|
? uri.substring(`data:${type}/`.length, uri.indexOf(";")) //Ex: extract 'mp4' from 'data:video/mp4;base64,....'
|
|
@@ -57,7 +34,7 @@ function sourceDeepCompareEquals(a, b) {
|
|
|
57
34
|
}
|
|
58
35
|
return a === b;
|
|
59
36
|
}
|
|
60
|
-
function useSourceDeepCompareMemoize(value) {
|
|
37
|
+
export function useSourceDeepCompareMemoize(value) {
|
|
61
38
|
const ref = React.useRef(undefined);
|
|
62
39
|
if (!sourceDeepCompareEquals(value, ref.current)) {
|
|
63
40
|
ref.current = value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaPlayerCommon.js","sourceRoot":"","sources":["../../../../../src/components/MediaPlayer/MediaPlayerCommon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MediaPlayerCommon.js","sourceRoot":"","sources":["../../../../../src/components/MediaPlayer/MediaPlayerCommon.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AA0B1B,MAAM,SAAS,GACb,oFAAoF,CAAC;AAEvF;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAiC,EACjC,IAAuB;IAEvB,MAAM,GAAG,GAAwB,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,GAAG,CAAC;IAErD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAEpD,MAAM,eAAe,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QACzD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,IAAI,GAAG,CAAC;YA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EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,QAA8B,EAC9B,YAAkC;IAElC,uDAAuD;IACvD,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ImageResizeMode } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
import type { MediaPlayerRef, MediaPlayerProps } from "../MediaPlayerCommon";
|
|
2
|
+
import { ImageProps, ImageResizeMode } from "react-native";
|
|
3
|
+
import { VideoViewProps as ExpoVideoProps, TimeUpdateEventPayload, VideoPlayer as VideoPlayerType } from "expo-video";
|
|
4
|
+
import type { MediaPlayerRef, MediaPlayerProps, MediaPlayerStatus } from "../MediaPlayerCommon";
|
|
5
5
|
type ResizeMode = "contain" | "cover" | "stretch";
|
|
6
|
-
type ExpoVideoPropsOmitted = Omit<ExpoVideoProps, "
|
|
6
|
+
type ExpoVideoPropsOmitted = Omit<ExpoVideoProps, "player" | "nativeControls">;
|
|
7
7
|
interface VideoPlayerProps extends ExpoVideoPropsOmitted, MediaPlayerProps {
|
|
8
8
|
resizeMode?: ResizeMode;
|
|
9
9
|
posterResizeMode?: ImageResizeMode;
|
|
10
|
+
posterSource?: ImageProps["source"];
|
|
11
|
+
usePoster?: boolean;
|
|
10
12
|
playsInSilentModeIOS?: boolean;
|
|
13
|
+
isMuted?: boolean;
|
|
14
|
+
useNativeControls?: boolean;
|
|
15
|
+
shouldPlay?: boolean;
|
|
16
|
+
isLooping?: boolean;
|
|
17
|
+
positionMillis?: number;
|
|
18
|
+
rate?: number;
|
|
19
|
+
volume?: number;
|
|
11
20
|
}
|
|
12
21
|
export interface VideoPlayerRef extends MediaPlayerRef {
|
|
13
22
|
toggleFullscreen: () => void;
|
|
14
23
|
}
|
|
15
24
|
declare const VideoPlayer: React.ForwardRefExoticComponent<VideoPlayerProps & React.RefAttributes<VideoPlayerRef>>;
|
|
25
|
+
export declare function mapToMediaPlayerStatus(status: TimeUpdateEventPayload, player: VideoPlayerType): MediaPlayerStatus;
|
|
16
26
|
export default VideoPlayer;
|