Please provide the following:
SDK Version: 35
Platforms(Android/iOS/web/all): all
I have the following code below. I’d like to get isPlaying
working, however it doesn’t seem to work.
<VideoPlayer
width={screenWidth / 4}
height={screenWidth / 4}
videoProps={{
isPlaying: () => alert("video playing!"),
shouldPlay: false,
resizeMode: Video.RESIZE_MODE_CONTAIN,
source: {
uri: uri
}
}}
inFullscreen={false}
/>
If I change isPlaying: () => alert("video playing!")
to isPlaying: alert("video playing!")
, then it prints the alert on load… which is obviously not what I want. What am I doing wrong here?
wodin
November 21, 2019, 4:29pm
2
Hi. It looks like you’re using expo-video-player, which as far as I can tell is not part of Expo, so might be best to move this to the Third Party Software category
But the following works for me:
import React, { useState } from "react";
import { StyleSheet, Text, View } from "react-native";
import { Video } from "expo-av";
import VideoPlayer from "expo-video-player";
export default () => {
const [isPlaying, setIsPlaying] = useState(false);
return (
<View style={styles.container}>
<Text>isPlaying: {JSON.stringify(isPlaying)}</Text>
<VideoPlayer
videoProps={{
shouldPlay: true,
resizeMode: Video.RESIZE_MODE_CONTAIN,
source: {
uri: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
}
}}
inFullscreen={false}
playbackCallback={status => {
if (isPlaying !== status.isPlaying) {
setIsPlaying(status.isPlaying);
}
}}
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
paddingTop: 80
}
});
system
Closed
December 11, 2019, 4:29pm
3
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.