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.
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];
<iframe src='http://www.youtube.com/embed/bhRqrw82P3A?modestbranding=1&showinfo=0&fs=0' width='300' height='175' frameborder='0' >
</iframe>
http://jsfiddle.net/tx77b/
//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.
Related
I'm in the process of adding a video that automatically plays to our Shopify store's homepage. Since the theme does only allow URL to the video, I tried to extract the URL with parameters from the embed code below to have the video play automatically.
URL that doesn't work:
https://player.vimeo.com/video/783962674?h=b8acf2d91a&autoplay=1&loop=1
Embed iframe code
<div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/783962674?h=b8acf2d91a&autoplay=1&loop=1" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
Is there a way to get URL that autoplays the video just like the embedded code?
I picked up the parameters from Iframe and made this URL https://player.vimeo.com/video/783962674?h=b8acf2d91a&autoplay=1&loop=1
I was trying to copy the same method to my website by using the below code, but when I implement other twitter user or account, it is not working. Can anyone check if the code format is still working in other Twiiter account?
<iframe border=0 frameborder=0 height=250 width=550 src="https://twitframe.com/show?url=https%3A%2F%2Ftwitter.com%2Fjack%2Fstatus%2F20"></iframe>
I created a JSFiddle and looks like the code is working fine! Tested with two other users and both are loading fine. You have to check if your URL is properly encoded and if you have any adblockers that blocks social media features.
Link: https://jsfiddle.net/ftcz6pdu/4/
Sample code:
<iframe border=0 frameborder=0 height=250 width=550 src="https://twitframe.com/show?url=https%3A%2F%2Ftwitter.com%2FItsSkyLOL%2Fstatus%2F1011166507257270273"></iframe>
<iframe border=0 frameborder=0 height=250 width=550 src="https://twitframe.com/show?url=https%3A%2F%2Ftwitter.com%2FPoppyHarlowCNN%2Fstatus%2F1010899818955333632"></iframe>
The online URL encoder that I used: https://meyerweb.com/eric/tools/dencoder/
I load a webpage with a url in webview,
and I want to replace all the "android" word in that page with "iOS",
How can I do that ?
You can use UIWebView's -stringByEvaluatingJavaScriptFromString: method to modify your HTML once it has been loaded:
[webView stringByEvaluatingJavaScriptFromString:
[NSString stringWithFormat:#"document.getElementById('android').innerHTML = iOS]];
for sample link
I have an issue trying to stream MP4 video files from Amazon S3 through a grails controller. I would like to host a video file on S3 and stream it (or send it) through a grails controller, that will be accessed by the front end that is a video.js player in a html page.
I need to keep the videos on S3 private, so just making the video public on S3 and using a direct url is not possible. Any help is appreciated.
Controller:
def video = {
def s3 = amazonWebService.s3
def file = s3.getObject(params.bucketName, params.key)
response.status = 206
response.contentType = "video/mp4"
response.outputStream << file.objectContent
response.outputStream.flush()
response.outputStream.close()
}
Video (GSP frontend):
<video id="example_video_1" class="video-js vjs-default-skin"
controls preload="auto" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{"example_option":true}'>
<source src="${createLink(controller:'home', action:'video', params:[bucketName:bucketInstance, key:videoFileInstance])}" type='video/mp4' />
</video>
You don't need to download the video.
Use the AWS Java SDK, get pre_signed URL for the video, using your bucket and key details. If your video is not of confidential nature, you can also create get a public URL for the video.
Use that pre-signed URL in the place of the SRC.
The video would still not play correctly in all the browsers, because you are having only one format MP4 in your video, which is not supported in all the browsers. You would need to upload the webm format as well to S3 and provide the URL for it in the videojs SRC for that format. For this you can use AWS video encoder, or you can use ffmpeg to do the conversion.
Finally you would be able to play the video in all the major browsers.
Hope this helps.
I created a Google Sites site and added a Like button using the IFrame option.
The button looks fine but when a user clicks Like, they receive the following error:
"Sorry, this post contains a suspicious URL: Unknown error".
It looks like a Facebook like issue, since the error message is displayed in a Facebook branded pop-up window.
My site: https://sites.google.com/site/wheresthezbfairlane/
How do I fix this ?
Help!
Thanks
Nick
If you copy pasted the code from the facebook plugin site you might have to remove the 'amp;'s that separate the query strings right after the href attribute.
<iframe src="//www.facebook.com/plugins/like.php?
href=http%3A%2F%2Fwww.facebook.com&width=450&height=80&colorscheme=light&layout=standard&action=like&show_faces=true&send=true"
scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
So, in the code above just replace '& amp;' with '&'