@nota/nativescript-audioplayer
由 nota 开发 | v8.4.2
专为 NativeScript 设计的全面功能 AudioPlayer。支持无缝音频播放列表播放,可变播放速度和原生远程控制
npm i --save @nota/nativescript-audioplayer

音频播放的 Nativescript 插件(Nativescript 8+)

使用方法

此插件已准备好,允许您通过 demo 文件夹进行测试和试用。此外,它还提供了一个合适的 .gitignore 文件,以保持 GitHub 整洁,以及 .npmignore 文件,以确保您通过 npm 发布插件时每个人都很满意。

Android 通知

可以通过字符串资源键 tns_audioplayer_notification_titletns_audioplayer_notification_desc 自定义 Android 前台通知通道。请参阅示例 strings.xml。通知图标可以通过在 App_Resources/Android/src/main/res 中有一个名为 tns_audioplayer_small_iconicon(按此顺序检查)的可绘制文件来设置。

开发

安装 TypeScript: npm install -g typescript

  1. 修改插件文件
  2. demo 中进行修改,以测试这些更改
  3. npm run demo.iosnpm run demo.android (必须从根目录运行)

这些 demo 任务只是通用助手。您可能希望对要运行的设备/模拟器有更细粒度的控制。为此,您可以手动运行这些操作

cd demo

// when developing, to ensure the latest code is built into the demo, it's a guarantee to remove the plugin and add it back
tns plugin remove @nota/nativescript-audioplayer
tns plugin add ..

// manual platform adds
tns platform add ios
// and/or
tns platform add android

然后使用 tns 命令行中的任何可用选项