html5 video player full screen issues

這問題被問許多次,就是 iPhone/iPad 上的影片是不是可以不要全畫面播放,這問題其實官方已經寫的很清楚,以下節錄至 Safari developer

Optimization for Small Screens

Currently, Safari optimizes video presentation for the smaller screen on iPhone or iPod touch by playing video using the full screen—video controls appear when the screen is touched, and the video is scaled to fit the screen in portrait or landscape mode. Video is not presented within the webpage. The height and width attributes affect only the space allotted on the webpage, and the controls attribute is ignored. This is true only for Safari on devices with small screens. On Mac OS X, Windows, and iPad, Safari plays video inline, embedded in the webpage.

Note: Prior to iOS 4.0, iPhone and iPod touch did not play audio inline. Audio was presented in full-screen mode. Audio plays inline on iOS 4.0 and later, on all devices.

最後這段重點就是,為了給小畫面最好的瀏覽品質,所以在 iphone 使用 mobile safari 或 webview(APP 中) 會用全畫面播放,而 iPad 因為畫面夠大,所以可以提供使用者/開發者選擇是否全畫面播放。

但是在 App 中還是有例外,因為小畫面無法非全畫面播放這件事情在 iOS SDK 中是一個參數,可以提供給開發者修改,在 webview 可以修改「allowsInlineMediaPlayback」參數,預設 iPhone 設定為「NO」,也就是強制播放影片時都是全畫面播放,如果設定為「YES」就可以在 webview 中直接播放影片,交給開發者自行配置。

相關連接 http://stackoverflow.com/questions/5054560/can-i-avoid-the-native-fullscreen-video-player-with-html5-on-iphone-or-android https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html

沒有留言:

張貼留言