-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't play a .mp3 file #1442
Comments
Can reproduce this on android (both on genymotion and avd) |
I'm using avd for android , i can play video, but when i try a .mp3, don't reproduces anything |
Can't play mp3 on Xiaomi Mi8 |
Maybe related to this: https://google.github.io/ExoPlayer/faqs.html#why-are-some-media-files-not-seekable I have managed to fix it in different react-native library |
I'm also not able to play |
Downgrading to 4.2.0 make mp3 files work |
I can't play m4a files either in 4.3.x, but it works in 4.2.0. |
I downgraded to v4.2.0 as @brian-pitsch said, and .mp3 file is able to be played. And I tried using Android MediaPlayer instead of Android ExoPlayer in v4.3.1, which worked but caused device to be slow when playing. |
Just wanted to point out that I had similar issues with version 4.4.0. I was also not able to play |
Thank you all guys for founding working 4.2.0 version! |
Hey there, I have seen everybody's solution of rolling react-native-video back to 4.2.0 to play .mp3 files. After unlinking, removing through package manager and adding version 4.2.0 and linking again, I am getting the following error. "Unable to resolve dependency for ':react-native-video@debug/compileClasspath': Could not resolve com.squareup.okhttp3:okhttp:3.12.0." Am I being dumb here and just missing the dependencies { implementation 'com.squareup.okhttp3:okhttp:3.12.0' } from my app build.gradle ? Any help would be greatly appreciated :) My current app/build.gradle below: `apply plugin: "com.android.application" import com.android.build.OutputFile project.ext.react = [ apply from: "../../node_modules/react-native/react.gradle" def enableProguardInReleaseBuilds = false android {
} dependencies { // Run this once to be able to run the application with BUCK |
Hey @Jimud1 - I'm also getting this error (Could not resolve okhttp3) when using [email protected] with [email protected] |
Sadly Douglas I did not find the solution for this fix, if you have any luck in the meantime be sure to put your results up here, I will do the same if I make any progress. Kind regards, James |
The solutions is described here: #1524 Basically, just replace Now, I have not succeeded in getting a (remote) mp3 or m4a file to play on 4.2.0 with RN-0.59.1, not on Android nor iOS. Also tried react-native-video 4.4.0 on RN-0.59.1, but no luck there either. |
I was able to get the project working on RN0-59.0 but did not try .1, I suggest rolling back to 59.0. Thanks for the help so far, does anybody know how it'd be best for me to ensure the change within the react-native-video always updates as expected, is it postInstall or preInstall using package.json scripts? or another key word? |
To resolve the okhttp issue i created a script as below and added it within a scripts folder try {
then within package.json { It's a bit of a dirty fix but it works. Good luck everybody! And thanks for the help! J |
Ok, I managed to get audio only working on both android and iOS. On iOS, it seems like having defined textTracks breaks playback of files which are audio only. So when I removed the following code audio starts working again:
On Android, implementing PR 1529 did the trick. I hope that one will get merged with the next release. On Android subtitles are displayed regardless of the file being audio only or not, but on iOS it just fails silently if the media file is audio only. It would be ideal if perhaps on iOS there could be an onError called with an appropriate description on those cases. Edit: This is with react-native-video 4.4.0 on RN 0.59.1 |
Funky when you're using local files are you using require('../path/to/file') instead of the uri??? E.g My bad I read that incorrectly. my bad. I wish you luck with the object definitions, hope you find the culprit! |
Yep. |
@funkyfourier does the mp3 files work on 4.4.0 if you don't specify the text tracks? 🤔 |
Yes, on iOS it does when not specifying text tracks. On Android it works, regardless of text tracks, if I implement PR 1529. |
|
Just tried the 4.4.1 release, and it is working fine for playing audio only files on android. |
I'm using the 4.4.4 release and are working for me. <Video
source={{uri: `file:./assets/sounds/myFile.mp3` }} to <Video
source={require('../../assets/sounds/myFile.mp3')} Full code: import React, { memo } from 'react'
import Video from 'react-native-video'
function AudioPlayer({ ref, source }) {
return (
<Video
source={source}
ref={(player) => {
ref = player
}}
muted={false}
repeat={false}
audioOnly={true}
resizeMode={"cover"}
volume={1.0}
rate={1.0}
ignoreSilentSwitch={"obey"}
/>
)
}
export default memo(AudioPlayer) |
Same issue trying to use textTracks with an mp3 on [email protected] |
I've tried use a path for my file, when i put a path to .mp4 file ok but when i put a .mp3 file in the same folder , the audio can't reproduce
my code for VideoComponent:
code for app.js :
The text was updated successfully, but these errors were encountered: