Sagar Aher Sagar Aher - 28 days ago 13
iOS Question

How to play vimeo video on UIwebview not in fullscreen ios swift 2.0

please any one can help me , how can i play Vimeo video with specific height and width on uiwebview iOS swift 2.0 . the problem is that it play successfully but in fullscreen mode . i have to play this video with specific height and width . because my iPhone app layout has [ header - body - footer ] . i want to play Vimeo video only on body portion where uiwebview present .
currently my app work but issue only on fullscreen . on full-screen header and footer is invisible .


here is my code

the embedHTML value is in html iframe tag


let embedHTML = <iframe>src=';byline=0&amp;portrait=0'width=\"100%\" height=\"100%\" frameborder=\"0\"</iframe>

let url: NSURL = NSURL(string: "http")!
webView.allowsInlineMediaPlayback = true
webView.loadHTMLString(embedHTML as String, baseURL:url )


In addition to

webView.allowsInlineMediaPlayback = true

your video needs to have a webkit-playsinline attribute.

Below text is from Apple docs:

"In order for video to play inline, not only does this property need to be set on the view, but the video element in the HTML document must also include the webkit-playsinline attribute."

So your video tag should look something like this:

Since you want to play vimeo, you would need to see if there is possiblity to add that attribute, else it looks impossible.