Comments (7)
All fine, I figured out the issue, I will be preparing a PR soon.
from just_audio.
PR is now merged, thank you!
from just_audio.
Hi @terryBaz , yes I welcome pull requests. This is definitely an important feature.
I think it would make sense for setUrl
to throw an exception and so a stream of errors on this occasion wouldn't be needed. This can be achieved on the platform side by sending an error through the platform channel. For example, on Android:
prepareResult.error("error message", null, null);
And on iOS with this code:
_connectionResult([FlutterError errorWithCode:@"error message"
message:nil
details:nil]);
from just_audio.
cool, that is what I started doing, but I am running into an issue with ExoPlayer State when I try to call prepareResult.error(...)
, the app is being killed (I am running the example project with a wrong url) plz let me know if u have some hints
- the added code to
AudioPlayer.java
@Override
public void onPlayerError(ExoPlaybackException error) {
switch (error.type) {
case ExoPlaybackException.TYPE_SOURCE:
Log.e(TAG, "TYPE_SOURCE: " + error.getSourceException().getMessage());
this.setError(String.valueOf(error.type), error.getUnexpectedException().getMessage());
break;
case ExoPlaybackException.TYPE_RENDERER:
Log.e(TAG, "TYPE_RENDERER: " + error.getRendererException().getMessage());
break;
case ExoPlaybackException.TYPE_UNEXPECTED:
Log.e(TAG, "TYPE_UNEXPECTED: " + error.getUnexpectedException().getMessage());
break;
default:
Log.e(TAG, "default: " + error.getUnexpectedException().getMessage());
}
}
....
private void setError(String errorCode, String errorMsg) {
this.dispose();
if (prepareResult != null) {
prepareResult.error(errorCode, errorMsg, null);
prepareResult = null;
}
}
....
public void dispose() {
player.release();
transition(PlaybackState.none);
}
- the log from LogCat
02-01 12:09:11.942 20841-20841/com.ryanheise.just_audio_example E/AudioPlayer: TYPE_SOURCE: Response code: 404
02-01 12:09:11.946 20841-20841/com.ryanheise.just_audio_example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ryanheise.just_audio_example, PID: 20841
java.lang.IllegalStateException
at com.google.android.exoplayer2.util.Assertions.checkState(Assertions.java:81)
at com.google.android.exoplayer2.ExoPlaybackException.getUnexpectedException(ExoPlaybackException.java:220)
at com.ryanheise.just_audio.AudioPlayer.onPlayerError(AudioPlayer.java:135)
at com.google.android.exoplayer2.ExoPlayerImpl$PlaybackInfoUpdate.lambda$run$2$ExoPlayerImpl$PlaybackInfoUpdate(ExoPlayerImpl.java:812)
at com.google.android.exoplayer2.-$$Lambda$ExoPlayerImpl$PlaybackInfoUpdate$fI_Ao37C4zouOtNaX7xHdRfgmVc.invokeListener(Unknown Source:2)
at com.google.android.exoplayer2.BasePlayer$ListenerHolder.invoke(BasePlayer.java:182)
at com.google.android.exoplayer2.ExoPlayerImpl.invokeAll(ExoPlayerImpl.java:845)
at com.google.android.exoplayer2.ExoPlayerImpl.access$000(ExoPlayerImpl.java:43)
at com.google.android.exoplayer2.ExoPlayerImpl$PlaybackInfoUpdate.run(ExoPlayerImpl.java:812)
at com.google.android.exoplayer2.ExoPlayerImpl.notifyListeners(ExoPlayerImpl.java:736)
at com.google.android.exoplayer2.ExoPlayerImpl.updatePlaybackInfo(ExoPlayerImpl.java:710)
at com.google.android.exoplayer2.ExoPlayerImpl.handlePlaybackInfo(ExoPlayerImpl.java:652)
at com.google.android.exoplayer2.ExoPlayerImpl.handleEvent(ExoPlayerImpl.java:595)
at com.google.android.exoplayer2.ExoPlayerImpl$1.handleMessage(ExoPlayerImpl.java:127)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7555)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
from just_audio.
Hi @terryBaz I'm curious about the code in your comment which is marked as "Resolved". Is that the code you were including in your PR?
from just_audio.
I already find a solution for this and I am using it, but I still did not prepare a PR yet, sorry for that, did not have time for it, but I will try to prepare one Asap (hopefully in the next 2 days)
from just_audio.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.
from just_audio.
Related Issues (20)
- Support HLS on web HOT 2
- Audio playback stops audio recording
- The audio is segmented HOT 2
- iOS MusicPlayer/Media Notification not showing on Lock Screen HOT 2
- MusicPlayerNotification not showing on iOS Lock Screen HOT 3
- [Android] Sound stops playing when backgrounding app and letting phone go to sleep HOT 2
- Track completes too eary HOT 10
- "Getting 'type 'Null' is not a subtype of type 'MediaItem' error with Just Audio Background package' HOT 2
- 22 kHz mono mp3s have wrong duration and seek behavior HOT 7
- Error during file preparation on Android 6 when playing MP3 files: "setConfig(1 .mp3.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)" HOT 2
- Error during file preparation on Android 6 when playing MP3 files HOT 4
- Compile WEB release plugin dosent work HOT 2
- Compile WEB release plugin dosent work HOT 6
- Sound is not played on iOS 17.5.1 in background HOT 2
- PlatformException(561017449, The operation couldn't be completed. (OSStatus error 561017449.), null, null) 👉 IOS HOT 2
- Support rxdart 0.28.0 HOT 1
- PlatformException(561017449, The operation couldn't be completed. (OSStatus error 561017449.), null, null) //IOS BUG HOT 2
- Incorrect AudioPlayer Position data on Android HOT 1
- Command failed for android_media_AudioSystem_error_callback: -32, AudioFlinger server died & AudioPolicyService server died. HOT 2
- Error when streaming on iOS or MacOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from just_audio.