react-native-track-player doesn't return the duration of the music, so I need some other way to get it.
I tried to use react-native-get-mp3-duration, mp3-duration, but what I want is the duration of the online file, not the local file, so I am having a problem.
Related
What am I doing?
A react-native-video component is loaded into the screen with a source uri from my nodejs backend.
What is the problem? (Only tried on android)
My backend is working fine and the video is loaded, but extremely slow. I checked on the backend that the video component is requesting a byte-range of 1MB every ~1s. On the other hand, if I request the video ranges with axios, it takes a couple of ms to request multiple byte-ranges.
When using a video stored locally on the android device, the loading time is almost instantaneous.
I tried the default android player as well as exoplayer with no difference in loading times.
I am trying all this with only one Video component and when I comment it the app runs smoothly
Possible solution:
I don't want to load the data directly from the Video component and I am trying now to download the byte-ranges and store them locally. Later I plan to load these byte-ranges into the Video component.
import AsyncStorage from '#react-native-async-storage/async-storage';
...
await AsyncStorage.setItem(video_name, JSON.stringify(byte_range_data_from_backend))
This works fine and I can read the byte_range_data_from_backend later with:
const data_from_item = await AsyncStorage.getItem(video_name)
What is my question?
How can I get these video_ranges uris to pass them to the Video component?
I think I need to create some kind of file and update the file content every time I receive a new byte-range. Meanwhile, I would like the video to be played using the already downloaded byte-ranges.
Is this possible or is not a good approach? What would be a possible way to load videos fast? It would be nice to download some byte-ranges before even trying to play the video, so that the waiting time for the user is minimal.
I'm working on a React Native App. I need to play a beep every 500ms. I already have a mp3 file to play and can it play on click. But after clicking the button a few times, it breaks. I used the example code from expo av. I used the snack from playing audio sounds.
I also could use another mp3 file which is longer, but has to start replaying immediately after ending.
What's the best way to play the beep every 500ms? Using a longer file and replay after ending? Or frequently use the single beep? How can I achieve that?
If you are using react-native-sound library, have a look at the link below: link
I have figured out how to upload photos to my app using expo-image-picker, but want to give users the option to take a photo in real time, and upload it into the app using expo-camera.
It may also be worth noting that I am on iOS.
I am using react-native-video to stream video in my app. The video starts with paused state.
From onLoadStart and onLoad event i see the video is started to load automatically even though it is paused. These videos are fetched from an URL, not in the assets of the app.
When i have multiple files in one screen it will take too much space in mobile. I want to keep space taken to minimal.
So i want to load files only if it is played by user by clicking the play button.
Is there a way to specify not to autoload files?
I am currently using react-native-image-picker to allow a user to select a video from their gallery. I am trying to disallow them from uploading a video that is greater than 'X' number of seconds. Is there anyway to programmatically retrieve the duration of the video, or is there another library that can be used to select videos from the camera roll that will provide all the information for the media object as well?