bdlukaa / just_audio_windows

Audio Player
9 stars 14 forks source link

Error using Chinese path #23

Closed fangjunai closed 4 months ago

fangjunai commented 1 year ago

Which API doesn't behave as documented, and how does it misbehave? Name here the specific methods or fields that are not behaving as documented, and explain clearly what is happening.

Minimal reproduction project

import 'package:flutter/material.dart';
import 'package:just_audio/just_audio.dart';
/

class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  final player = AudioPlayer();
  String path = "C:\\Users\\FangJun\\Music\\123.mp3";  //normal
  String path2 = "C:\\Users\\FangJun\\Music\\莫问归期 - 蒋雪儿.mp3"; //Error using Chinese path

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Music')),
      body: Center(
        child: Column(
          children: [playButton(), stopButton()],
        ),
      ),
    );
  }

  Widget playButton() {
    return ElevatedButton(
      onPressed: doPlay,
      child: const Text("Play"),
    );
  }

  Widget stopButton() {
    return ElevatedButton(
      onPressed: doStop,
      child: const Text("Stop"),
    );
  }

  void doPlay() async {
    await player.setAudioSource(AudioSource.file(path2)); //Error using Chinese path
    await player.play();
  }

  void doStop() async {
    await player.stop();
  }
}

To Reproduce (i.e. user steps, not code)

Error messages

[just_audio_windows] Called setVolume
[just_audio_windows] Called setSpeed
[just_audio_windows] Called setPitch
[just_audio_windows] Called setSkipSilence
[just_audio_windows] Called setLoopMode
[just_audio_windows] Called setShuffleMode
[just_audio_windows] Called load
[just_audio_windows] Media error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Loading interrupted
#0      AudioPlayer._load
<asynchronous suspension>
#1      AudioPlayer._setPlatformActive.setPlatform
<asynchronous suspension>

Expected behavior Normal playback of music with Chinese path

Screenshots

Desktop (please complete the following information):

Flutter SDK version

PS C:\Users\FangJun> flutter doctor
Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [版本 10.0.17763.4131], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.4.4)
[√] Android Studio (version 2022.1)
[√] VS Code (version 1.80.1)
[√] Connected device (2 available)
[!] Network resources
    X An HTTP error occurred while checking "https://github.com/": 信号灯超时时间已到

! Doctor found issues in 3 categories.
PS C:\Users\FangJun>

Additional context Add any other context about the problem here.

BilguunTs commented 1 year ago

Yes same issue here https://stackoverflow.com/questions/76734908/unable-to-load-audio-files-with-unicode-characters-in-file-name-in-just-audio-wi?noredirect=1#comment135307462_76734908

fvthakor commented 10 months ago

Yes same issue here when folder name like 98º

anchao-lu commented 5 months ago

Same issue, any plan on Chinese path?

huangsir0 commented 5 months ago

Same issue, any plan on Chinese path?

canxin121 commented 4 months ago

close by #34

bdlukaa commented 4 months ago

I published a new version that should fix this issue!