Cordova – Playing videos using jQuery Mobile and Phonegap

I’m not familiar with mobile applications yet, so I’m trying to use Phonegap and jQuery Mobile to build a simple video player. The problem is that jQuery mobile seems to be blocking for some reason Video playback.

To troubleshoot, I stripped it back to the following HTML, but got the same result, that is, the video should be a black rectangle, but there is no video playback or controls.
















< /div>

If I delete the link of jquery.mobile-1.2.0.js, the video will be displayed and played, otherwise only The black rectangle will be displayed.

I don’t know jQuery mobile at all, but the reference to search for the video element in js does not show up, so I don’t know what is blocking it.

The code works well in Chrome and Firefox. There are no console messages in Xcode. I also tried to connect to http://debug.phonegap.com/, but this also did not give any error messages.

Any ideas? ?

This happens because ios will prevent inline media playback.
For ios you The following content should be added in config.xml

Let your The code works.
You may need to add webkit-playsinline to the video tag
For more look at Config.xml cordova doc

You may need to set other attributes, such as

< p>

MediaPlaybackRequiresUserAction(boolean) or MediaPlaybackRequiresUserAction(boolean)

Get full details about them in Config.xml cordova doc

I am not familiar with mobile applications yet, so I tried to use Phonegap and jQuery Mobile to build a simple video player. The problem is that jQuery mobile seems to be blocking the video playback for some reason.

To troubleshoot, I stripped it back to the following HTML, but got the same result, i.e. the video should be a black rectangle, but there is no video playback or controls.

< pre>









If I delete the link of jquery.mobile-1.2.0.js, the video will be displayed and played, otherwise only the black rectangle will be displayed.

I don’t know jQuery mobile at all. , But the reference to search for the video element in js doesn't show up, so I don't know what is blocking it.

The code works well in Chrome and Firefox. There is no console message in Xcode. I Also tried to connect to http://debug.phonegap.com/, but this also did not give any error messages.

Any ideas? ?

This happens because ios will prevent inline media playback.
For ios you should add the following in config.xml

Make your code work.
You may need to add webkit- Add playsinline to the video tag
See more about Config.xml cordova doc

You may need to set other attributes, such as

MediaPlaybackRequiresUserAction(boolean ) or MediaPlaybackRequiresUserAction(boolean)

Get full details about them in Config.xml cordova doc

Leave a Comment

Your email address will not be published.