Phonegap:在锁屏和下拉状态栏中显示音频控制和我的音频流的元信息

Phonegap: Showing audio controlls and meta informations of my audio stream in the lockscreen and the dropdown status bar

本文关键字:我的 音频 控制 音频流 信息 显示 状态栏 Phonegap      更新时间:2023-09-26

我为phonegap 5.1编写了我的第一个工作android应用程序,播放音频流。由于我找不到结果:我如何在锁屏和下拉状态栏中显示音频控制和我的音频流的元信息?

我使用的是org.apache.cordova.media插件

我的建议,使用https://github.com/katzer/cordova-plugin-local-notifications -我在android上使用它,最新的棒棒糖你应该能够显示有动作按钮的卡通知。

它应该是相当容易调整插件添加您的动作按钮。检查这个http://developer.android.com/guide/topics/ui/notifiers/notifications.html

对于通知的实际内容(歌曲标题,长度,…),您需要使用Media插件api自己填充。

千篇一律h1> 只适用于iOS: https://github.com/shi11/RemoteControls.

使用Cordova命令行界面,输入以下命令来安装RemoteControls:

cordova plugin add com.rd11.remote-controls

并且每次要更新锁屏时使用以下代码:

var params = [artist, title, album, image, duration, elapsedTime];
window.remoteControls.updateMetas(function(success) {
    console.log('Metas successfully updated!');
}, function(fail) {
    console.log('Duh! Something nasty happened');
}, params);
<标题> 2。通知h1> 找不到任何现有的插件来显示播放器控件的持久通知,因此您必须创建一个自定义插件或使用JavascriptInterface