简体   繁体   English

有什么方法可以在 flutter 中播放 windows 桌面应用程序的音频文件?

[英]Any way to play audio file for windows desktop application in flutter?

I'm new to flutter and making a desktop application with flutter. Now I need to load and play audio files but found that the audio player packages don't support desktop software in windows. So if there is any way to play audio file for windows desktop software using flutter, then please give me an example.我是 flutter 的新手,正在用 flutter 制作桌面应用程序。现在我需要加载和播放音频文件,但发现音频播放器包不支持 windows 中的桌面软件。所以如果有任何方法可以播放音频文件windows桌面软件使用flutter,那请举个例子。

Note: After searching a bit I found this ( flutter_audio_desktop ) but unfortunately it's status is "DISCONTINUED".注意:经过一番搜索后,我发现了这个 ( flutter_audio_desktop ),但不幸的是它的状态是“DISCONTINUED”。

You can use this plugin https://pub.dev/packages/just_audio .你可以使用这个插件https://pub.dev/packages/just_audio It supports windows, Mac and Linux also它也支持 Windows、Mac 和 Linux

Have you been able to get https://pub.dev/packages/just_audio working?您是否能够让https://pub.dev/packages/just_audio工作? I get error when I start the application in debug (from android Studio).在调试中启动应用程序时出现错误(来自 android Studio)。

[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) #1 MethodChannelJustAudio.init (package:just_audio_platform_interface/method_channel_just_audio.dart:13:5) #2 AudioPlayer._setPlatformActive.setPlatform (package:just_audio/just_audio.dart:1255:13) [错误:flutter/lib/ui/ui_dart_state.cc(209)] 未处理的异常:MissingPluginException(在频道 com.ryanheise.just_audio.methods 上找不到方法 init 的实现)#0 MethodChannel._invokeMethod(包:flutter/src/services /platform_channel.dart:165:7) #1 MethodChannelJustAudio.init (package:just_audio_platform_interface/method_channel_just_audio.dart:13:5) #2 AudioPlayer._setPlatformActive.setPlatform (package:just_audio/just_audio.dart:1255:13)

just_audio plugin has a support for windows as well. just_audio 插件也支持 windows。 You can use that plugin to play audio file.您可以使用该插件播放音频文件。 There is another plugin named audioplayers which also has windows support in the prelease version 1.0.0-rc.1.还有另一个名为 audioplayers 的插件,在预发布版本 1.0.0-rc.1 中也支持 windows。

Dart VLC is also a good option to play audio files for flutter desktop application. Dart VLC也是为 flutter 桌面应用程序播放音频文件的不错选择。 This package can play both audio and video files.这个package可以播放音频和视频文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM