问题
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.
Please help me.
Thanks
回答1:
You may have to initialize jPlayer on user action in Mobile Safari.
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.
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.
Ref: http://www.jplayer.org/latest/developer-guide/#jPlayer-known-issues-event-driven
回答2:
Do you mean it doesn't play automatically? Because if it does, I don't see what your problem is.
回答3:
Check if you have entered the correct path for option swfPath.
来源:https://stackoverflow.com/questions/5898257/jplayer-doesnt-play-audio-file-automatically-in-ipad