简体   繁体   English

在iOS上的Cordova App中播放视频而没有声音

[英]Video in cordova app on ios without sound

I am building an app for both iOS and Android with Cordova 3.1. 我正在使用Cordova 3.1构建适用于iOS和Android的应用程序。 On iOS, the videos will be played as they should, but always without sound. 在iOS上,视频将按原样播放,但始终没有声音。 And I don't know why. 而且我不知道为什么。

I have intergrated the videos with the html-tag like this: 我已经将视频与html标签集成在一起,如下所示:

<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插件:

$ 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: iOS上的config.xml看起来像这样:

....
<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". 我也尝试过name =“ MediaPlaybackRequiresUserAction” value =“ false”和name =“ AllowInlineMediaPlayback” value =“ false”。

On the iOS Simulator (of Xcode) everything is all right. 在(Xcode的)iOS模拟器上,一切正常。 But on my iOS-device (iOS 7), the videos will be played always without sound. 但是在我的iOS设备(iOS 7)上,视频将始终无声音播放。 The same with audio-files. 音频文件也一样。 I hear nothing. 我什么也没听到。
On Android it works. 在Android上可以使用。

What is going wrong? 怎么了?

Solution (for me): Turn your phone off silent. 解决方案(对我而言):以静音方式关闭手机。

I'm not kidding. 我不是在开玩笑。 Try it. 试试吧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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