简体   繁体   中英

Video in cordova app on ios without sound

I am building an app for both iOS and Android with Cordova 3.1. On iOS, the videos will be played as they should, but always without sound. And I don't know why.

I have intergrated the videos with the html-tag like this:

<video class="video" controls="true">
   <source src="http://www.domain.de/Video1/video.mp4">
   <source src="http://www.domain.de/Video1/video.ogv">
</video>

The following cordova plugins are installed:

$ cordova plugin list
 [ 'org.apache.cordova.device',
   'org.apache.cordova.file',
   'org.apache.cordova.inappbrowser',
   'org.apache.cordova.media' ]

And the config.xml on iOS looks like this:

....
<feature name="LocalStorage">
    <param name="ios-package" value="CDVLocalStorage" />
</feature>
<feature name="InAppBrowser">
    <param name="ios-package" value="CDVInAppBrowser" />
</feature>
<access origin="*" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="UIWebViewBounce" value="true" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="EnableLocation" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="true" />
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="OpenAllWhitelistURLsInWebView" value="false" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<feature name="Device">
    <param name="ios-package" value="CDVDevice" />
</feature>
<feature name="File">
    <param name="ios-package" value="CDVFile" />
    <param name="onload" value="true" />
</feature>
<feature name="Media">
    <param name="ios-package" value="CDVSound" />
</feature>

I have also tried name="MediaPlaybackRequiresUserAction" value="false" and name="AllowInlineMediaPlayback" value="false".

On the iOS Simulator (of Xcode) everything is all right. But on my iOS-device (iOS 7), the videos will be played always without sound. The same with audio-files. I hear nothing.
On Android it works.

What is going wrong?

Solution (for me): Turn your phone off silent.

I'm not kidding. Try it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM