Reputation: 1715
In my app I am using UIWebview to Load Html string which is having Text,Image Url and Videos in iFrame.This was working fine till now but recently I came to know that text and image url are loading fine and the video is not loading.I am just getting the blank space which I have allocated for the video but no sign of video.
The video iFrame which I am getting is this:
<iframe width="100%" height="" src="//www.youtube.com/embed/bhRqrw82P3A" frameborder="0" allowfullscreen></iframe>
Please suggest if something has changed in API.
Upvotes: 3
Views: 4068
Reputation: 6335
See this difference:
src="//www.youtube.com/embed/bhRqrw82P3A"
src="http://www.youtube.com/embed/bhRqrw82P3A"
If you want to use first one you have to add "http:" into your URL to make it valid link. You can do it very easy by adding some base URL when loading HTML string into UIWebView
NSURL *baseURL = [NSURL URLWithString:@"http:"];
[self.contentWebView loadHTMLString:myHTMLCode
baseURL:baseURL];
Upvotes: 3
Reputation: 189
//www.youtube.com/embed/bhRqrw82P3A uses scheme depends on server (http or https...etc). In local HTML it will point to file://www.youtube.com/embed/bhRqrw82P3A. I make a fake http host for loading:
[webView loadHTMLString:yourHTMLCode baseURL:[NSURL URLWithString:@"http://localhost"]];
This works for me.
Upvotes: 0
Reputation: 23271
<iframe src='http://www.youtube.com/embed/bhRqrw82P3A?modestbranding=1&showinfo=0&fs=0' width='300' height='175' frameborder='0' >
</iframe>
Upvotes: 0