如何设置当前歌曲的信息到iPhone锁屏与JS [英] How to set informations of current song to iPhone lock screen with JS
问题描述
我在我的网页上有一个音频元素,我想在播放时将信息(标题,艺术家,专辑等)设置到iPhone锁屏。 (With JS)
I got an audio element on my page and i want to set the informations (title, artist, album etc.) to the iPhone lock screen while playing. (With JS)
如何实现?
推荐答案
是不可能只是用Javascript。如果您只在浏览器中运行Javascript,则无法访问锁定屏幕功能。
This is not possible just with Javascript. If you're just running Javascript in a browser it has no access to the lock screen functionality.
编辑:
由于你使用PhoneGap,这是可能的。您需要访问 MPNowPlayingInfoCenter
类。至少有一个插件,AudioStream,让你访问。请在这里查看: https://github.com/liip/phonegap-plugins-audiostream
Since you're using PhoneGap, it is possible. You need to access the MPNowPlayingInfoCenter
class. There is at least one plugin, AudioStream, that gives you access. Check it out here: https://github.com/liip/phonegap-plugins-audiostream
这篇关于如何设置当前歌曲的信息到iPhone锁屏与JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!