jPlayer不会在iPad中自动播放音频文件 [英] jPlayer doesn't play audio file automatically in iPad
问题描述
我正在尝试使用iPad中的jPlayer播放音频文件。它在我的本地PC上的Safari工作正常,但当我试图在我的iPad上打开它时,它不会自动播放音频。
I am trying to play audio file using jPlayer in iPad. It works fine in Safari on my local PC but when I tried to open it in my iPad it doesn't play audio automatically.
请帮助我。
谢谢
推荐答案
您可能需要在Mobile Safari中初始化用户操作的jPlayer。
You may have to initialize jPlayer on user action in Mobile Safari.
第一次播放媒体元素必须由用户gester启动。即,用户必须单击播放按钮。这会影响就绪事件处理程序中jPlayer(play)的操作。浏览器将忽略该命令。 jPlayer将等到用户按下播放按钮。
收到第一个手势后,允许JavaScript代码使用media元素执行任何操作。请注意,jPlayer媒体播放器实例使用音频和视频元素。每个人都需要自己的姿态。
The first time a media element is played must be initiated by a user gester. ie., The user must click the play button. This affects the operation of a jPlayer("play") in the ready event handler. The browser will ignore the command. jPlayer will simply wait until the user presses the play button. Once the first gesture has been received, JavaScript code is then allowed to do whatever you want with the media element. Note that a jPlayer media player instance uses a audio and a video element. Each require their own gesture.
作为一个黑客,您可以在外部容器元素(或主体)上为触摸事件添加处理程序并初始化任何jPlayer您想要的实例。
As a hack, you could possibly add a handler for a touch event on an outer container element (or body) and initialize any jPlayer instances that you want.
参考: http://www.jplayer.org/latest/developer-guide/#jPlayer-known-issues-event-driven
这篇关于jPlayer不会在iPad中自动播放音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!