Cocoa Webkit Development

Cocoa Webkit Development_第1张图片
None

Here are some refer document for COCOA webkit.

webkitRequestFullscreen

website use this method to enter full screen mode.

document.body.webkitRequestFullscreen()

Refer to:https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API

cocoa webview has implement this method.

https://developer.apple.com/library/safari/documentation/WebKit/Reference/ElementClassRef/

webkitfullscreenchange Event

the webkitfullscreenchange event will fire when enter or exist full screen.

OS X: the webkitfullscreenchange event fires when an element enters or exits full-screen mode.

iOS: the webkitbeginfullscreen and webkitendfullscreen events fire when a video enters and exits full-screen mode, respectively.

Refer to:https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html#//apple_ref/doc/uid/TP40009523-CH3-SW11

allowfullscreen attribute for iframe

for iframe we need the allowfullscreen.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe

Note:the youtube is telling the fullscreen is unavailable

as our website is working fine ,so the real reason should be 'Your browser may not support fullscreen.'

https://support.google.com/youtube/answer/6276924

the best solution is 'make web view in cocoa app enable to support’, till now I have not found the solution yet.

Another solution : custom fullscreen window.

1.create a custom fullscreen window to load the full screen window

2.place a custom button on your web site.

3.when button click ,calling the app to show the video fullscreen window.

你可能感兴趣的:(Cocoa Webkit Development)