如何在后台使用通知栏上的选项在后台运行Cordova音乐播放器 [英] How to run cordova music player in background with options available on notification bar

查看:282
本文介绍了如何在后台使用通知栏上的选项在后台运行Cordova音乐播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cordova媒体插件构建用于Android手机的音乐播放器应用程序.

I am building music player application for android phone using cordova media plugin.

借助插件,我现在能够播放本地音乐,我想添加一个功能,即使用户关闭了该应用程序也是如此. 音乐播放器应在后台运行,并在通知栏中提供播放,暂停和退出选项.

With the help of plugin i am able to play the local music now i wants to add a feature that even if the application is closed by the user. Music player should run in background with play,pause,exit options available in notification bar.

在这种情况下,有谁能帮助我?

Can any one help me in this case.

预先感谢

推荐答案

我在这里使用此插件,它在android上对我有效: https://github.com/homerours/cordova-music-controls-plugin

I'm using this plugin here, and it works for me on android: https://github.com/homerours/cordova-music-controls-plugin

它不会自动为您控制媒体,但是您可以处理它的事件并自己控制媒体.

It does not control the media for you automatically though, you have handle its events and control the media yourself.

请记住,目前,如果系统在后台关闭了您的应用,则仍会显示通知.这是一个已知的错误.

Keep in mind that at the moment, if your app is closed in the background by the system, the notification will still be shown. This is a known bug.

这篇关于如何在后台使用通知栏上的选项在后台运行Cordova音乐播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆