Skip to content
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

queryArtworks throws error #11

Closed
dev-davexoyinbo opened this issue Jun 13, 2021 · 2 comments
Closed

queryArtworks throws error #11

dev-davexoyinbo opened this issue Jun 13, 2021 · 2 comments
Labels
PRI: Low Can be resolved after other higher priority issues T: Bug Something isn't working

Comments

@dev-davexoyinbo
Copy link

dev-davexoyinbo commented Jun 13, 2021

queryArtworks throws error after upgrade. It was working fine before the upgrade but it always throws an error now.

Android Version: Android 10 (Nokia 6.1 plus)
on_audio_query_version: ^1.0.8

I'm calling the queryArtWork in this method

Future<ImageProvider> getAudioImage(SongModel? songModel) async {
    Uint8List? uint8list;
    if (songModel != null && songModel.artwork == null) {
      print("===========>Song model Id: ${songModel.id}");
      try{
        uint8list =
        await OnAudioQuery().queryArtworks(songModel.id, ArtworkType.AUDIO);
      }catch( error){
        print("======================An error was caught=================");
        print(error.toString());
        print("======================End Log=================");
      }
    }

    if(uint8list != null){
      return Future.value(MemoryImage(uint8list));
     }
    return Future.value(placeholderImage());
  } //end method getAudioImage

This is how I used it in the flutter ui

               FutureBuilder<ImageProvider>(
                  future: musicController.getAudioImage(musicController.currentSong.value),
                  builder: (context, snapshot) {
                    if ((snapshot.connectionState == ConnectionState.done)) {
                      return Container(
                        // height: 320,
                        width: double.infinity,
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(5),
                          image: DecorationImage(
                            image: snapshot.data as ImageProvider,
                            fit: BoxFit.cover,
                          ),
                        ),
                      );
                    } else {
                      return Container(
                        // height: 320,
                        width: double.infinity,
                        child: Center(
                          child: CircularProgressIndicator(
                            color: MyTheme.accentColor,
                          ),
                        ),
                      );
                    }
                  },
                ),

Error log:

I/flutter ( 6623): ===========>Song model Id: 13405 E/MethodChannel#com.lucasjosino.on_audio_query( 6623): Failed to handle method call E/MethodChannel#com.lucasjosino.on_audio_query( 6623): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at com.lucasjosino.on_audio_query.query.OnArtworksQuery.queryArtworks(OnArtworksQuery.kt:37) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at com.lucasjosino.on_audio_query.controller.OnAudioController.onAudioController(OnAudioController.kt:26) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at com.lucasjosino.on_audio_query.OnAudioQueryPlugin.onCheckPermission(OnAudioQueryPlugin.kt:114) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at com.lucasjosino.on_audio_query.OnAudioQueryPlugin.onMethodCall(OnAudioQueryPlugin.kt:83) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at android.os.MessageQueue.next(MessageQueue.java:336) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at android.os.Looper.loop(Looper.java:174) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at android.app.ActivityThread.main(ActivityThread.java:7397) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/MethodChannel#com.lucasjosino.on_audio_query( 6623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) I/flutter ( 6623): ======================An error was caught================= I/flutter ( 6623): PlatformException(error, java.lang.Integer cannot be cast to java.lang.Long, null, java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long I/flutter ( 6623): at com.lucasjosino.on_audio_query.query.OnArtworksQuery.queryArtworks(OnArtworksQuery.kt:37) I/flutter ( 6623): at com.lucasjosino.on_audio_query.controller.OnAudioController.onAudioController(OnAudioController.kt:26) I/flutter ( 6623): at com.lucasjosino.on_audio_query.OnAudioQueryPlugin.onCheckPermission(OnAudioQueryPlugin.kt:114) I/flutter ( 6623): at com.lucasjosino.on_audio_query.OnAudioQueryPlugin.onMethodCall(OnAudioQueryPlugin.kt:83) I/flutter ( 6623): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) I/flutter ( 6623): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) I/flutter ( 6623): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818) I/flutter ( 6623): at android.os.MessageQueue.nativePollOnce(Native Method) I/flutter ( 6623): at android.os.MessageQueue.next(MessageQueue.java:336) I/flutter ( 6623): at android.os.Looper.loop(Looper.java:174) I/flutter ( 6623): at android.app.Activit I/flutter ( 6623): ======================End Log=================

@LucJosin
Copy link
Owner

Can you add more information? Android version, on_audio_query version, all error log?

@LucJosin LucJosin added the S: More info Further information is requested label Jun 13, 2021
@dev-davexoyinbo
Copy link
Author

Can you add more information? Android version, on_audio_query version, all error log?

I just made an edit and added the necessary information

@LucJosin LucJosin added PRI: Low Can be resolved after other higher priority issues S: Fixing This issue will be fixed soon T: Bug Something isn't working S: To-Do Feature or request that still need doing and removed S: More info Further information is requested S: Fixing This issue will be fixed soon labels Jun 14, 2021
@LucJosin LucJosin added Status: Fixed and removed S: To-Do Feature or request that still need doing labels Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PRI: Low Can be resolved after other higher priority issues T: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants