Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Exception has occurred. JSNoSuchMethodError (NoSuchMethodError: invalid member on null: 'invokeMethod') #140

Open
muqaddir opened this issue Sep 15, 2020 · 0 comments

Comments

@muqaddir
Copy link

The Exception is thrown by
durationWatcher = player.onDurationChange.listen((event) { channel.invokeMethod("audio.onStart", (player.duration * 1000).toInt()); });

in the method below

void _play(String url) {
  player = html.AudioElement(url);

  endWatcher = player.onEnded.listen((event) {
    channel.invokeMethod("audio.onComplete");
  });
  durationWatcher = player.onDurationChange.listen((event) {
    channel.invokeMethod("audio.onStart", (player.duration * 1000).toInt());
  });
  progressWatcher = player.onTimeUpdate.listen((event) {
    channel.invokeMethod(
        "audio.onCurrentPosition", (player.currentTime * 1000).toInt());
  });
  player.play();
}

I tried to call the method in an icon button

child: IconButton(
          icon: Icon(
              isPressed == false ? Icons.play_arrow : Icons.pause),
               iconSize: 40,
               onPressed: () {
              audioplayer._play(
                            "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/Music_for_Video/springtide/Sounds_strange_weird_but_unmistakably_romantic_Vol1/springtide_-_03_-_We_Are_Heading_to_the_East.mp3");
                      },
                    ),  

Screenshot 2020-09-15 171018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant