How can i volume set in uiwebview with swift?

╄→尐↘猪︶ㄣ 提交于 2020-02-07 21:49:15

问题


I play video using YouTube iFrame. Closed youtube controls in webview perfectly. player.playVideo(),player.stopVideo() working but player.mute() and player.Setvolume (60) does not. does anyone help me? i am using this module https://github.com/gilesvangruisen/Swift-YouTube-Player/


回答1:


YouTube Api

Most of the JavaScript Player API functions have Objective-C equivalents, though some of the naming may differ slightly to more closely match Objective-C coding guidelines. Notable exceptions are methods controlling the volume of the video, since these are controlled by the phone hardware or with built in UIView instances designed for this purpose, such as MPVolumeView.

https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW10

Volume Control in JavaScript

On the desktop, you can set and read the volume property of an or element. This allows you to set the element’s audio volume relative to the computer’s current volume setting. A value of 1 plays sound at the normal level. A value of 0 silences the audio. Values between 0 and 1 attenuate the audio. This volume adjustment can be useful, because it allows the user to mute a game, for example, while still listening to music on the computer. On iOS devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript. Reading the volume property always returns 1.



来源:https://stackoverflow.com/questions/29239491/how-can-i-volume-set-in-uiwebview-with-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!