如何解决Cordova 音乐控制插件,如何使其工作?
@Rivers 使用此代码:
<div onclick="play();" id="play" class="play">
PLAY
</div>
<div onclick="pause()" id="stop" class="disable stop">
STOP
</div>
<div>
<audio id="player" controls>
<source src="https://9230.brasilstream.com.br/stream" type="audio/aac">
</audio>
</div>
<script src="cordova.js"></script>
<script src="js/jquery351min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script type="text/javascript">
var audioplayer = document.getElementById("player");
function play(){
audioplayer.play();
}
function pause(){
audioplayer.pause();
}
</script>
我有这个: IMG LINK
而且工作得很好...
但我也需要这个:CONTROL PLAYER ON THE NOTIFICATION AREA
这应该适用于以下代码:
LINK 插件:https://github.com/ghenry22/cordova-plugin-music-controls2
audioplayer.MusicControls.create({
track : 'Time is Running Out',// optional,default : ''
artist : 'Muse',default : ''
album : 'Absolution',default: ''
cover : 'albums/absolution.jpg',default : nothing
// cover can be a local path (use fullpath 'file:///storage/emulated/...',or only 'my_image.jpg' if my_image.jpg is in the www folder of your app)
// or a remote url ('http://...','https://...','ftp://...')
isPlaying : true,default : true
dismissable : true,default : false
// hide previous/next/close buttons:
hasPrev : false,// show previous button,optional,default: true
hasNext : false,// show next button,default: true
hasClose : true,// show close button,default: false
// iOS only,optional
duration : 60,default: 0
elapsed : 10,default: 0
hasSkipForward : true,//optional,default: false. true value overrides hasNext.
hasSkipBackward : true,default: false. true value overrides hasPrev.
skipForwardInterval : 15,//optional. default: 0.
skipBackwardInterval : 15,//optional. default: 0.
hasScrubbing : false,//optional. default to false. Enable scrubbing from control center progress bar
// Android only,optional
// text displayed in the status bar when the notification (and the ticker) are updated
ticker : 'RADIO GAZETA"',//All icons default to their built-in android equivalents
//The supplied drawable name,e.g. 'media_play',is the name of a drawable found under android/res/drawable* folders
playIcon: 'media_play',pauseIcon: 'media_pause',prevIcon: 'media_prev',//nextIcon: 'media_next',//closeIcon: 'media_close',notificationIcon: 'notification'
},onSuccess,onError);
但它不起作用,我不知道我是否做错了什么,因为我是该领域的新手,并且在 git 文档中没有示例。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。