just_audio_windows Cannot seek duration on Windows

Issue

 [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(position, the position argument can not be null, null, null)
    #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
    #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
    <asynchronous suspension>
    #2      MethodChannelAudioPlayer.seek (package:just_audio_platform_interface/method_channel_just_audio.dart:152:34)
    <asynchronous suspension>

#3      AudioPlayer.seek (package:just_audio/just_audio.dart:1070:9)
<asynchronous suspension>

Using just on Windows 10_ audio_ Windows to compile the fluent application, but the player cannot seek duration

Solution

After 1 day debugging I solve this issue with changing line 225 in the player.hpp file inside just_audio_windows/windows/player.hpp.

change it from:

const auto* position = std::get_if<int_64_t>(ValueOrNull(*args, "position"));

to:

const auto* position = std::get_if<int>(ValueOrNull(*args, "position"));

Answered By – Amirshk

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published