MissingPluginException(No implementation found for method init on channel com.ryanheise.just_audio.methods)

1,432

Solution 1

just_audio doesn't include a Windows implementation. As it says in the README, you need to include another package such as just_audio_libwinmedia that provides a Windows implementation of the package.

Solution 2

Hi If you have used some package, then after pub get try to restart app(Not hot restart, build it again) then it will work.

Share:
1,432
Sadikul Haque Sadi
Author by

Sadikul Haque Sadi

Updated on December 01, 2022

Comments

  • Sadikul Haque Sadi
    Sadikul Haque Sadi over 1 year

    I am building a desktop application using flutter where I need to play audio files from local storage and for this I am using just_audio flutter package since it supports Windows. But I Couldn't find any examples of it for windows. I have coded something like this-

    import 'package:just_audio/just_audio.dart';
    ...
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatefulWidget {
      @override
      _MyAppState createState() => _MyAppState();
    }
    
    class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
      final _player = AudioPlayer();
    
      @override
      void initState() {
        super.initState();
        ...
        _init();
      }
       
      Future<void> _init() async {
        await _Player.setFilePath('C:/Users/Admin/Downloads/test.wav', preload: true);
      }
      ...
    

    The await call never finishes and I am getting the following error:

    [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method init on channel com.ryanheise.just_audio.methods)
    #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
    <asynchronous suspension>
    #1      MethodChannelJustAudio.init (package:just_audio_platform_interface/method_channel_just_audio.dart:13:5)
    <asynchronous suspension>
    #2      AudioPlayer._setPlatformActive.setPlatform (package:just_audio/just_audio.dart:1255:13)
    <asynchronous suspension>
    #3      AudioPlayer.load (package:just_audio/just_audio.dart:708:26) 
    <asynchronous suspension>
    #4      AudioPlayer.setAudioSource (package:just_audio/just_audio.dart:683:18)
    <asynchronous suspension>
    
  • Sadikul Haque Sadi
    Sadikul Haque Sadi over 2 years
    It didn't help. I'm getting the same result.
  • Muhammad Ashir
    Muhammad Ashir over 2 years
    Try to change the audio package which you are using.
  • Muhammad Ashir
    Muhammad Ashir over 2 years
    or maybe you can try to update the version
  • Sadikul Haque Sadi
    Sadikul Haque Sadi over 2 years
    Yeah. After adding the just_audio_libwinmedia and libwinmedia, the previous error has been solved