Code Monkey home page Code Monkey logo

just_audio_windows's People

Contributors

agersant avatar akindone avatar amirhosseinshk avatar bdlukaa avatar camerash avatar canxin121 avatar cedvdb avatar creativecreatorormaybenot avatar ened avatar ewertonls avatar hsangtini avatar jei avatar josephcrowell avatar kmod-midori avatar lightrabbit avatar lkho avatar minhqdao avatar narumi147 avatar nt4f04und avatar nuc134r avatar pschuegr avatar ryanheise avatar smkhalsa avatar snaeji avatar snipd-mikel avatar stonega avatar subhash279 avatar tarekbazine avatar timilehinjegede avatar zekfad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

just_audio_windows's Issues

There are several problems: 1. The seek bar cannot be seek. 2. There is only one channel. 3. Cannot play local file. 4. No callback after playback

There are several problems: 1. The seek bar cannot be seek. 2. There is only one channel. 3. Cannot play local file. 4. No callback after playback

1、const auto* position = std::get_if(ValueOrNull(*args, "position")); int64_t -> int

2、 const auto* pitch = std::get_if(ValueOrNull(*args, "pitch")); need set pitch = 0;

3、//Create a new picker
var filePicker = new Windows.Storage.Pickers.FileOpenPicker();

//make a collection of all video types you want to support (for testing we are adding just 3).
string[] fileTypes = new string[] {".wmv", ".mp4", ".mkv"};

//Add your fileTypes to the FileTypeFilter list of filePicker.
foreach (string fileType in fileTypes)
{
filePicker.FileTypeFilter.Add(fileType);
}

4、must add a method

Channels and platform threading error

Which API doesn't behave as documented, and how does it misbehave?
When the audio tries to play, the following error is given

[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
[ERROR:flutter/shell/common/shell.cc(1015)] The 'com.ryanheise.just_audio.events.d5e27073-96dd-47df-bc50-39a5ebd90ea3' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
[ERROR:flutter/shell/common/shell.cc(1015)] The 'com.ryanheise.just_audio.data.d5e27073-96dd-47df-bc50-39a5ebd90ea3' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.

Minimal reproduction project
n/a

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

Expected behavior
I expected the sound to be played and not error

Screenshots
n/a

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome

Smartphone (please complete the following information):

  • Device: Huawei honor 10 lite
  • OS: Android 10

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.9, on Microsoft Windows [Version 10.0.22631.3085], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.4)
[√] Android Studio (version 2023.1)
[√] VS Code (version 1.86.0)
[√] Connected device (3 available)
[√] Network resources

• No issues found!

Additional context
n/a

Playing audio sometimes crashes - EXCEPTION CAUGHT BY SERVICES LIBRARY

When trying to play audio, it sometimes works, other times, it crashes.
In some of the cases, I'm jumping to a next track (calling _player.stop().then(... load & play next track ...)) even if the current one has not finished playing yet.

Minimal reproduction project
(tbd)

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

Error messages

══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following PlatformException was thrown while de-activating platform stream on channel
com.ryanheise.just_audio.events.fb5e3488-e6f6-42dc-98c6-fb2b2d6a0b68:
PlatformException(error, No active stream to cancel, null, null)

When the exception was thrown, this was the stack:
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
<asynchronous suspension>
#2      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:649:9)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════

Expected behavior
No crashes.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10.0.19045.2251

Flutter SDK version

[√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.19045.2251], locale en-US)

`currentIndex` is not always getting reported correctly in events

The currentIndex parameter isn't always getting set correctly on the broadcastPlaybackEvent method. I think this is because mediaPlaybackList isn't getting updated unless the playback type is concatenating, but it could be caused by something else.

Things seem to be better behaved if I make the changes:
image
such that mediaPlaybackList is always updated, but I don't have enough of an understanding of what everything else is doing to know what affect this will have on the rest of the plugin's operation.

WAV data of initially unknown length through StreamAudioSource is silent for prolonged periods of time before playing

Which API doesn't behave as documented, and how does it misbehave?
When an AudioPlayer plays from a StreamAudioSource that returns a response with a stream containing WAV PCM data and contentLength: null, sourceLength: null, offset: null to indicate that the overall length of the stream is not currently known, e.g. background sound that is continually generated, the audio is not played immediately. It may instead be played several minutes after the request completes, even for short amounts of data, e.g. 1 second long.

Minimal reproduction project

import 'dart:async';
import 'dart:math';
import 'dart:typed_data';

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Chromatic scale',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Chromatic scale'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

const int _kRIFF = 0x52494646; // "RIFF"
const int _kWAVE = 0x57415645; // "WAVE"
const int _kfmt_ = 0x666d7420; // "fmt "
const int _kdata = 0x64617461; // "data"
const int _kMaxSize = 0xffffffff;
const int _kWavHeaderSize = 44;

// Generate a WAV header for a much-too-long file, as length may be unknown ahead of time, or infinite
int _writeWavHeader(ByteData dst, int hz, int nChannels, int nBytes) {
  dst.setUint32(0, _kRIFF, Endian.big);
  dst.setUint32(4, _kMaxSize, Endian.little);
  dst.setUint32(8, _kWAVE, Endian.big);
  dst.setUint32(12, _kfmt_, Endian.big);
  dst.setUint32(16, 16, Endian.little);
  dst.setUint16(20, 1, Endian.little);
  dst.setUint16(22, nChannels, Endian.little);
  dst.setUint32(24, hz, Endian.little);
  dst.setUint32(28, hz * nChannels * nBytes, Endian.little);
  dst.setUint16(32, nBytes * nChannels, Endian.little);
  dst.setUint16(34, nBytes * 8, Endian.little);
  dst.setUint32(36, _kdata, Endian.big);
  dst.setUint32(40, _kMaxSize, Endian.little);
  return _kWavHeaderSize;
}

// Audio source that generates PCM data and returns it with a WAV header
class StreamingSource extends StreamAudioSource {
  static const int _sampleRate = 44100;
  double frequency;

  StreamingSource([this.frequency = 440]);

  @override
  Future<StreamAudioResponse> request([int? start, int? end]) async {
    int t0 = start ?? 0;
    int nSecs = 1;
    int t1 = end ?? (_sampleRate * nSecs + _kWavHeaderSize);
    int len = t1 - t0;
    print('Requesting $start to $end, returning data of $len long.');
    assert(len >= _kWavHeaderSize);
    Uint8List data = Uint8List(len);
    int endOfHeader = _writeWavHeader(data.buffer.asByteData(), _sampleRate, 1, 1);
    for (int i = 0; i < data.length - endOfHeader; i++) {
      double samp = sin(i * 2 * pi * frequency / _sampleRate) * 0.5 + 0.5;
      data[endOfHeader + i] = (samp * 255).toInt();
    }
    return StreamAudioResponse(
      sourceLength: null,
      contentLength: null,
      offset: null,
      stream: Stream.fromIterable([data]),
      contentType: 'audio/wav',
      rangeRequestsSupported: true,
      );
  }

}

class _MyHomePageState extends State<MyHomePage> {
  late AudioPlayer _player;
  late StreamingSource _source;

  @override
  void initState() {
    super.initState();
    _player = AudioPlayer();
    _source = StreamingSource(440);
    _initPlayer();
  }

  Future<void> _initPlayer() async {
    await _player.pause();
    await _player.setAudioSource(_source, preload: false);
  }

  Future<void> _playTone() async {
    _source.frequency *= pow(2.0, 1.0/12);
    await _player.stop();
    await _player.seek(Duration.zero); // Stop and seek necesssary to request audio again
    await _player.play();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: _playTone,
        tooltip: 'Play',
        child: const Icon(Icons.add),
      ),
    );
  }
}

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Run the above sample.
  2. Press the floating action button to call play

Actual behavior:
No audio is played for around 5 minutes, then the brief sine tone can be heard.

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 play
[just_audio_windows] Called load
flutter: Requesting 0 to null, returning data of 44144 long.

Expected behavior
Once the audio data is requested and received from the Stream returned by StreamAudioSource.request, it should play a 1-second long sine tone of the current frequency.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Win 10

Smartphone (please complete the following information):
N/A

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.12.0-1.0.pre.14, on Microsoft Windows [Version 10.0.19045.2965], locale en-US)
    ! Flutter version 3.12.0-1.0.pre.14 on channel [user-branch] at C:\src\flutter\flutter\flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) 
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.5.1)
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.78.2)
[√] Connected device (3 available)
[√] Network resources

Additional context
The owner of the just_audio repo has stated that this is a bug with the native player.

`currentIndex` is not always getting reported correctly in events

Which API doesn't behave as documented, and how does it misbehave?
AudioPlayer::broadcastPlaybackEvent doesn't set the currentIndex parameter correctly.

Minimal reproduction project
Subscribe to the playbackEventMessageStream stream on an audio player instance, and observe the state of the currentIndex parameter (when the playback type is not concatenating).

To Reproduce (i.e. user steps, not code)
Subscribe to the playbackEventMessageStream stream on an audio player instance, and observe the state of the currentIndex parameter (when the playback type is not concatenating).

Error messages
This doesn't directly cause error messages, but breaks integration with just_audio_background

Expected behavior
The currentIndex should be set to 0 when the media is playing.

Screenshots
Things seem to be better behaved if I make the changes:
image
such that mediaPlaybackList is always updated, but I don't have enough of an understanding of what everything else is doing to know what affect this will have on the rest of the plugin's operation.

Desktop (please complete the following information):

  • OS: Windows

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22621.819], locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.4)
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

[bug] broadcastPlaybackEvent : No such interface supported

Which API doesn't behave as documented, and how does it misbehave?

The error occurs when playing a flac file from http url.

It is thrown by this line of code: L520

This code throws a No such interface supported error when trying to use the win api's MediaPlayer.PlaybackSession().BufferingProgress() (inside BufferingProgress).

This causes all of Win's music playback data to be lost due to this error, but in reality this BufferingProgress does very little for the data.

Minimal reproduction project
Provide a link here using one of two options:

  1. Only change the music url to flac in some of this repo's example, and this error occurs

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Only change the music url to flac in some of this repo's example, and this error occurs

Error messages
No such interface supported

[just_audio_windows] Broadcast event error: 不支持此接口(in english: No such interface supported)

Expected behavior
No error and the playback data trans successfully.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):
Win 10 ltsc 21H2

Smartphone (please complete the following information):
? this repo only supports windows.?

Flutter SDK version

Not releated.

Additional context
None

Unable To Play AAC-LC Encoding Files

Which API doesn't behave as documented, and how does it misbehave?
I am trying to use the record package to record microphone audio, and then play it. I am encoding the audio file using the AAC-LC encoder that the package provides. The audio file is saved as an m4a, and it works well. The audio file can be read and played on an android application using the just_audio no problem.

But on desktop, with just_audio_windows the file is unable to be read

Minimal reproduction project
The Example project.
Use AudioSource.file to load this file: https://drive.google.com/file/d/1e9i7WGS9qQFFDjPj9E-QPD24A32ta_8P/view?usp=share_link

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Run the project

Error messages

[just_audio_windows] Media error:
flutter: Error loading audio source: Loading interrupted

Expected behavior
The audio file is read. It can be played, paused, and time should be visible.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10

Smartphone (please complete the following information):

  • Device: Pixel 7
  • OS: Android 13

Flutter SDK version
Ignore the Android Studio warning

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.9, on Microsoft Windows [Version 10.0.19044.2728], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.0)
[√] Android Studio (version 2021.2)
[!] Android Studio (version 4.1)
    X Unable to determine bundled Java version.
[√] IntelliJ IDEA Community Edition (version 2021.3)
[√] VS Code (version 1.77.1)
[√] Connected device (3 available)
[√] HTTP Host Availability

! Doctor found issues in 1 category.

'IUnknown': ambiguous symbol when running a windows app

Please don't make it difficult to report bugs.

Which API doesn't behave as documented, and how does it misbehave?
There is no specific API, the plugin will not build.

Minimal reproduction project
See steps to reproduce (minimal reproduction is a fresh project)

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Create new project
  2. Add just_audio and just_audio_windows to pubspec.yaml
  3. Run the flutter app as a 'Windows' app

Error messages

C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(463,14): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(478,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(608,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(734,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(864,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1106,55): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1135,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1458,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1588,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1744,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2094,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2206,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2306,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2789,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2909,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(3240,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(3478,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5042,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5307,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5436,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5638,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5754,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5876,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6034,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6485,14): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6516,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6752,24): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6754,26): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6767,55): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\dxgi.h(315,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]

Expected behavior
The plugin builds without errors.

Screenshots
No screenshots available, its just the error text.

Desktop (please complete the following information):

  • OS: Windows 10 Pro
  • No browser

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 3.4.0-19.0.pre.190, on Microsoft Windows [Version 10.0.19044.1826], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.6)  
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.72.2)
[√] Connected device (3 available)
[√] HTTP Host Availability

• No issues found!

Additional context
The plugin does not build properly.

Issue with Non-ASCII Characters in File Path for "just_audio_windows"

Description:
When attempting to load audio files with Unicode characters in their names, such as "дуу.mp3," the "just_audio_windows" seems to encounter issues.

Steps to Reproduce:

  1. Install the latest version of "just_audio_windows."
  2. Use the following code to load an audio file with a Unicode name:
///not actual production code but example
import 'package:just_audio/just_audio.dart';

void loadUnicodeAudio() {
  final audioPlayer = AudioPlayer();
  audioPlayer.setFilePath('D:/examplefolder/дуу.mp3');
  // Add code for audio playback.
}
void loadUnicodeAudio2() {
  final audioPlayer = AudioPlayer();
  audioPlayer.setFilePath('D:/дуу/song.mp3');
  // Add code for audio playback.
}

Expected Behavior:
The "just_audio_windows" and "just_audio" should load and play audio files with Unicode characters in their names without any errors.

Actual Behavior:
[just_audio_windows] Item error: The system cannot find the path specified.
Instead, the audio player throws an exception or fails to load the file properly when Unicode characters are present in the file name.

Environment:
just_audio : ^0.9.31
just_audio_windows: ^0.2.0

Flutter version: 3.10.2
Operating System: Windows 11

FAQ:

Do I really need to submit a minimal reproduction project for a bug?
A: Yes, I understand the importance of providing a minimal reproduction project, and I'll work on creating one ASAP to help resolve the issue.

I will also explore potential solutions and investigate whether it's a platform-specific issue or related to the "just_audio_windows" extension itself. If the problem persists, I'll reach out to the maintainers of the "just_audio_windows" extension on GitHub with this detailed report.

Audio balance is set to right channel only

Which API doesn't behave as documented, and how does it misbehave?
setPitch()
The setPitch function changes the audio balance instead of the pitch.

Minimal reproduction project
Minimal reproduction

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Build the project for windows
  2. Click on Play
  3. Observe audio only coming from the right channel
  4. Use the different buttons to change pitch
  5. Observe audio balance changing instead of pitch

Expected behavior
With a default player I expect the audio to be stereo as in the case with just_audio for other platforms.
I also expect the setPitch() function to change the pitch instead of audio balance.

Screenshots
https://user-images.githubusercontent.com/10712909/195821286-47bc0263-5a9f-4aca-9c29-bc023ccf7645.mp4

Desktop (please complete the following information):

  • OS: Windows 11

Flutter SDK version

[√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.22621.674], locale en-SE)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2022 17.3.3)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.72.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

• No issues found!

Additional context
Looking through the code in player.hpp it seems to me that this part is the cause.

AudioBalance as described here seems to not change the pitch, unfortunately I couldn't find an alternative for it.

WAV data of initially unknown length through `StreamAudioSource` is silent for prolonged periods of time before playing

When an AudioPlayer plays from a StreamAudioSource that returns a response with a stream containing WAV PCM data and contentLength: null, sourceLength: null, offset: null to indicate that the overall length of the stream is not currently known, e.g. background sound that is continually generated, the audio is not played immediately. It may instead be played several minutes after the request completes, even for short amounts of data, e.g. 1 second long.

Minimal reproduction project

import 'dart:async';
import 'dart:math';
import 'dart:typed_data';

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Chromatic scale',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Chromatic scale'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

const int _kRIFF = 0x52494646; // "RIFF"
const int _kWAVE = 0x57415645; // "WAVE"
const int _kfmt_ = 0x666d7420; // "fmt "
const int _kdata = 0x64617461; // "data"
const int _kMaxSize = 0xffffffff;
const int _kWavHeaderSize = 44;

// Generate a WAV header for a much-too-long file, as length may be unknown ahead of time, or infinite
int _writeWavHeader(ByteData dst, int hz, int nChannels, int nBytes) {
  dst.setUint32(0, _kRIFF, Endian.big);
  dst.setUint32(4, _kMaxSize, Endian.little);
  dst.setUint32(8, _kWAVE, Endian.big);
  dst.setUint32(12, _kfmt_, Endian.big);
  dst.setUint32(16, 16, Endian.little);
  dst.setUint16(20, 1, Endian.little);
  dst.setUint16(22, nChannels, Endian.little);
  dst.setUint32(24, hz, Endian.little);
  dst.setUint32(28, hz * nChannels * nBytes, Endian.little);
  dst.setUint16(32, nBytes * nChannels, Endian.little);
  dst.setUint16(34, nBytes * 8, Endian.little);
  dst.setUint32(36, _kdata, Endian.big);
  dst.setUint32(40, _kMaxSize, Endian.little);
  return _kWavHeaderSize;
}

// Audio source that generates PCM data and returns it with a WAV header
class StreamingSource extends StreamAudioSource {
  static const int _sampleRate = 44100;
  double frequency;

  StreamingSource([this.frequency = 440]);

  @override
  Future<StreamAudioResponse> request([int? start, int? end]) async {
    int t0 = start ?? 0;
    int nSecs = 1;
    int t1 = end ?? (_sampleRate * nSecs + _kWavHeaderSize);
    int len = t1 - t0;
    print('Requesting $start to $end, returning data of $len long.');
    assert(len >= _kWavHeaderSize);
    Uint8List data = Uint8List(len);
    int endOfHeader = _writeWavHeader(data.buffer.asByteData(), _sampleRate, 1, 1);
    for (int i = 0; i < data.length - endOfHeader; i++) {
      double samp = sin(i * 2 * pi * frequency / _sampleRate) * 0.5 + 0.5;
      data[endOfHeader + i] = (samp * 255).toInt();
    }
    return StreamAudioResponse(
      sourceLength: null,
      contentLength: null,
      offset: null,
      stream: Stream.fromIterable([data]),
      contentType: 'audio/wav',
      rangeRequestsSupported: true,
      );
  }

}

class _MyHomePageState extends State<MyHomePage> {
  late AudioPlayer _player;
  late StreamingSource _source;

  @override
  void initState() {
    super.initState();
    _player = AudioPlayer();
    _source = StreamingSource(440);
    _initPlayer();
  }

  Future<void> _initPlayer() async {
    await _player.pause();
    await _player.setAudioSource(_source, preload: false);
  }

  Future<void> _playTone() async {
    _source.frequency *= pow(2.0, 1.0/12);
    await _player.stop();
    await _player.seek(Duration.zero); // Stop and seek necesssary to request audio again
    await _player.play();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: _playTone,
        tooltip: 'Play',
        child: const Icon(Icons.add),
      ),
    );
  }
}

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Run the above sample.
  2. Press the floating action button to call play

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 play
[just_audio_windows] Called load
flutter: Requesting 0 to null, returning data of 44144 long.

Expected behavior
Once the audio data is requested and received from the Stream returned by StreamAudioSource.request, it should play a 1-second long sine tone of the current frequency.

Actual behavior
No audio is played for around 5 minutes, then the brief sine tone can be heard.

Desktop (please complete the following information):

  • OS: Win

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.12.0-1.0.pre.14, on Microsoft Windows [Version 10.0.19045.2965], locale en-US)
    ! Flutter version 3.12.0-1.0.pre.14 on channel [user-branch] at C:\src\flutter\flutter\flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) 
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.5.1)
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.78.2)
[√] Connected device (3 available)
[√] Network resources

Additional context
The owner of the just_audio repo has stated that this is a bug with the native player.

Playing audio sometimes crashes - EXCEPTION CAUGHT BY SERVICES LIBRARY

Which API doesn't behave as documented, and how does it misbehave?
play - stop - setAsset - play

Minimal reproduction project
The example

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Play audio
  2. Skip to next track.

Error messages

══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following PlatformException was thrown while de-activating platform stream on channel
com.ryanheise.just_audio.events.fb5e3488-e6f6-42dc-98c6-fb2b2d6a0b68:
PlatformException(error, No active stream to cancel, null, null)

When the exception was thrown, this was the stack:
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
<asynchronous suspension>
#2      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:649:9)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════

Expected behavior
No crash.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10

Smartphone (please complete the following information):
Nope

Flutter SDK version

[√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.19045.2251], locale en-US)

Additional context
None

Issue with space in File Path for "just_audio_windows"

Description:
When attempting to load audio files with space in their names, such as "C:\Users\HP\Downloads\Ve Kamleya Rocky Aur Rani Kii Prem Kahaani 320 Kbps.mp3" the "just_audio_windows" seems to encounter issues.

Steps to Reproduce:

  • Install the latest version of "just_audio_windows."
  • Use the following code to load an audio file with a space name:
await _player.setAudioSource(AudioSource.uri(Uri.parse(path)));

Expected Behavior:
The "just_audio_windows" and "just_audio" should load and play audio files with space in their names without any errors.

Actual Behavior:
[just_audio_windows] Item error: The system cannot find the path specified.
Instead, the audio player throws an exception or fails to load the file properly when space are present in the file name.

Environment:
just_audio : ^0.9.34
just_audio_windows: any

Flutter version: 3.10.6
Operating System: Windows 11

image

Channels and platform threading error

Which API doesn't behave as documented, and how does it misbehave?
When the audio tries to play, the following error is given

[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
[ERROR:flutter/shell/common/shell.cc(1015)] The 'com.ryanheise.just_audio.events.d5e27073-96dd-47df-bc50-39a5ebd90ea3' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
[ERROR:flutter/shell/common/shell.cc(1015)] The 'com.ryanheise.just_audio.data.d5e27073-96dd-47df-bc50-39a5ebd90ea3' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.

Minimal reproduction project
n/a

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

Expected behavior
I expected the sound to be played and not error

Screenshots
n/a

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome

Smartphone (please complete the following information):

  • Device: Huawei honor 10 lite
  • OS: Android 10

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.9, on Microsoft Windows [Version 10.0.22631.3085], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.4)
[√] Android Studio (version 2023.1)
[√] VS Code (version 1.86.0)
[√] Connected device (3 available)
[√] Network resources

• No issues found!

Additional context
n/a

[bug] broadcastPlaybackEvent : No such interface supported

The error occurs when playing a flac file.

It is thrown by this line of code: L520

This code throws a No such interface supported error when trying to use the win api's MediaPlayer.PlaybackSession().BufferingProgress() (inside BufferingProgress).

This causes all of Win's music playback data to be lost due to this error, but in reality this BufferingProgress does very little for the data.

Seek doesn't work properly on long videos

Which API doesn't behave as documented, and how does it misbehave?
The seek() method doesn't behave as expected on Windows. Calling seek to a specific position seems to update the position data in the positionDataStream, but the actual audio continues playing from the original position.

Minimal reproduction project
The just_audio example.

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Press the Play button.
  2. Seek somewhere far ahead using the seek bar - e.g. to the halfway point.
  3. The bar updates, but audio continues playing from the beginning.

If you seek a small amount forward (e.g. 5 mins), the seek seems to behave as expected.

Error messages
No errors displayed

Expected behavior
The audio should always match the seek position on screen.

Screenshots
The screen looks as expected, but the audio played doesn't match. E.g. screen shows 45 mins in, but you're actually in the first minute of audio.

Desktop (please complete the following information):

  • OS: Windows 11

Smartphone (please complete the following information):

  • Device: Pixel 7 Pro
  • OS: Android 13

Web:

  • OS: Windows 11
  • Browser: Microsoft Edge 112.0.1722.48

Everything works as expected on Android and Web. The issue is only present on Windows.

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.12, on Microsoft Windows [Version 10.0.22621.1555], locale en-GB)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✗] 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 Build Tools 2022 17.3.6)
[!] Android Studio (not installed)
[✓] VS Code (version 1.77.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

Additional context
Raised a similar issue ryanheise#971 on the just_audio repo, but was redirected here as it seems to be limited to windows.

Issue with space in File Path for "just_audio_windows"

Which API doesn't behave as documented, and how does it misbehave?
When attempting to load audio files with space in their names, such as "C:\Users\HP\Downloads\Ve Kamleya Rocky Aur Rani Kii Prem Kahaani 320 Kbps.mp3" the "just_audio_windows" seems to encounter issues.

Minimal reproduction project
Provide a link here using one of two options:

Future<void> _init(path) async {
    final session = await AudioSession.instance;
    await session.configure(const AudioSessionConfiguration.speech());
    // Listen to errors during playback.
    _player.playbackEventStream.listen((event) {},
        onError: (Object e, StackTrace stackTrace) {
      print('A stream error occurred: $e');
    });
    // Try to load audio from a source and catch any errors.
    try {
      //var newPath = path.toString().replaceAll(" ", "+");
      //var encoded = Uri.encodeFull(path);
      // String fixedUrl = Uri.encodeQueryComponent(path);
      //print(fixedUrl);
      print(path);
      await _player.setAudioSource(AudioSource.uri(Uri.parse(path)));
      // await _player.setAudioSource(AudioSource.uri(Uri.parse(
      //     "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")));
    } catch (e) {
      print("Error loading audio source: $e");
    }
  }

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Install the latest version of "just_audio_windows."
  2. Use the following code to load an audio file with a space name:
  3. See error

Error messages

Media error: 
flutter: Error loading audio source: Loading interrupted

Expected behavior
The "just_audio_windows" and "just_audio" should load and play audio files with space in their names without any errors.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Window app

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.19045.3271], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web                                                
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.6.5)   
[√] Android Studio (version 2022.3)                                             
[√] VS Code (version 1.80.2)                                                    
[√] Connected device (3 available)                                              
[√] Network resources    

Additional context

Inquiry about Minimum Supported Windows SDK Version

To which pages does your suggestion apply?

Quote the sentences(s) from the documentation to be improved (if any)

Insert here. (Skip if you are proposing an entirely new section.)

Describe your suggestion
Hello,

I am interested in using the [just_audio_windows] plugin for a project that targets Windows. Before I proceed, I would like to confirm the minimum supported version of the Windows SDK required by this plugin to ensure compatibility with my development environment and target Windows platforms.

I have checked the CMakeLists.txt and other documentation but could not find specific information regarding the Windows SDK version.
Could you please provide some guidance on the minimum Windows SDK version that is compatible with the [just_audio_windows] plugin? This information will be very helpful for setting up my development environment correctly.

Thank you for your assistance and for the work you've put into this plugin.

Best regards

Windows crashes as soon as audio is played

Which API doesn't behave as documented, and how does it misbehave?
.setAudioSource and .play()

Minimal reproduction project
Provide a link here using one of two options:

https://github.com/aguilaair/just_audio/tree/minor/just_audio/example

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

Error messages

Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
Connecting to VM Service at ws://127.0.0.1:60047/i8qvas6k-44=/ws
000002ABD62412B8
Lost connection to device.
Exited (sigterm)

Expected behavior
Audio plays

Screenshots
If applicable, add screenshots to help explain your problem.
imagen

Desktop (please complete the following information):

  • OS: Windows 11 Build 22621.819

Flutter SDK version

[√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.22621.819], locale es-ES)
    • Flutter version 3.3.9 on channel stable at C:\Users\Eduardo\fvm\default
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (2 days ago), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at C:\Users\Eduardo\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.0)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.2.32505.173
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] VS Code (version 1.73.1)
    • VS Code at C:\Users\Eduardo\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.48.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.819]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 107.0.5304.107
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 106.0.1370.47

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Error using Chinese path

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):

  • OS: win10 x64

Smartphone (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.

'IUnknown': ambiguous symbol when running app

Hello, I recently just came back to a project I was working on involving this plugin. This plugin was working a while ago, but just today I encountered a new problem when trying to run my project.

flutter run
and selecting 'Windows' causes the build to fail with the following errors:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(463,14): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(478,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(608,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(734,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(864,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1106,55): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1135,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1458,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1588,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(1744,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2094,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2206,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2306,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2789,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(2909,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(3240,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(3478,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5042,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5307,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5436,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5638,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5754,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(5876,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6034,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6485,14): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6516,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6752,24): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6754,26): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ocidl.h(6767,55): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\dxgi.h(315,5): error C2872: 'IUnknown': ambiguous symbol [D:\GitHub\WoodBird-MP3\build\windows\plugins\just_audio_windows\just_audio_windows_plugin.vcxproj]

After a little bit of research, it seems that the generated files for the plugin do not specify which 'IUnkown' to use. This is way beyond me, I have no clue how to fix this. I'm not even sure if it's related to this plugin, or if it is an issue on my end. I have no clue how to reproduce this, and this issue is preventing my windows version of the app to not be able to play sound. I was planning on making my repo public after double checking that the basic functionality worked, but I ran into this issue. Removing this plugin from my pubspec.yaml resolves the errors, but then audio playback does not work. Any help would be appreciated, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.