I have many url's like this:
https://www.youtube.com/watch?v=81_2Xb0XB_E&feature=youtube_gdata
I want to see in my app only the video, rather than a youtube page.
How can I go about this?
So far I have tried:
urlValue = [urlValue stringByReplacingOccurrencesOfString:#"watch?v="
withString:#"v/"];
urlValue = [urlValue stringByReplacingOccurrencesOfString:#"&feature"
withString:#"?version=3&f=playlists&app"];
This is the final url :
https://www.youtube.com/v/81_2Xb0XB_E?version=3&f=playlists&app=youtube_gdata_player
And this is how I load it:
NSString *videoHTML = [NSString stringWithFormat:#"<iframe type=\"text/html\" width=\"305\" height=\"180\" src=\"%#\" frameborder=\"0\"></iframe>", urlValue];
For some of them it's ok, I can watch it, but for others, like this url I cant watch. ("Watch this video on youtube . Playback on other website has been disabled by the video owner").
Any idea how can I improve my code? or if it's because of url?
Here is an example of url which is working:
http: //www.youtube.com/v/9M3wwddDec4?version=3&f=playlists&app=youtube_gdata_player
Give this a try HCYoutubeParser
Related
I am working on an app in which i have to display videos comes from JSON server some of them are youtube video and some are from other resources.
My problem is when i want to play video the videos which are from youtube link are playing perfectly but the other videos are not playing.
i imported <AVFoundation/AVFoundation.h>, <AVKit/AVKit.h>, MediaPlayer/MediaPlayer.h files also i imported YTPlayerView Files
I am using following code in UIWebView
[self.webvw setAllowsInlineMediaPlayback:YES];
[self.webvw setMediaPlaybackRequiresUserAction:NO];
NSString* embedHTML = [NSString stringWithFormat:#"%#",videoStr];
[self.webvw loadHTMLString:embedHTML baseURL:[[NSBundle mainBundle] resourceURL]];
The other video format is look like as:
"embed_code": "<object width="430" height="344"><embed width="430" height="344" type="application/x-shockwave-flash" wmode="transparent" src="http://xxxxxxx.xxxxxx/static/jscript/player/flowplayer/flowplayer.swf?config={'clip':{'baseUrl': 'http://myconnect.media/file/video/','url': '2017/02/3d045f0f240bfb73305f77c3da4d9218.flv','autoBuffering': true,'autoPlay': false}}"></embed></object>"
I am using YTPlayerView for playing embedded videos in my app. Everything works perfect with ID but video doesn't play with URL. Here is my code
-(IBAction)playVideo:(id)sender{
self.playerView.delegate = self;
self.playerView.hidden = false;
[self.playerView loadVideoByURL:#"https://www.youtube.com/watch?v=KWTULSf29Ho" startSeconds:0 suggestedQuality:kYTPlaybackQualitySmall];
}
The URL has to be in the format youtube.com/v/VIDEO_ID?version=3, your url was wrong.
if you want to achieve the specific format, change your method which for responding user input url, appending ?version=3 with user input url.
check this,i think you forgot load the video into the player
In my app IOS I must play videos that reside on server. When I call the URL (http://www.example.com/example/?q=courses/9/module/148) from computer's browser it returns file (.flv) and the browser asked me if I have to save or open the file.
How to do to play video in IOS app'view by URL address?
Is it possible by UIWebView?
Thanks
First create an String with your html embed code, here is an example:
NSString *htmlString = [NSString stringWithFormat: #"<iframe src=\"http://myvideo.com" width=\"305\" height=\"150\" frameborder=\"0\" scrolling=\"no\"> </iframe>"];
Then load the address into your web view
[self.myWebView loadHTMLString:htmlString baseURL:[NSURL URLWithString:#"http://whicheveraddresyouwant.com"]];
i'm trying to use VLC to playback youtube online video for IOS5.
I set a NSURL to MVLCMovieViewController, use code like this:
NSString *conntentURL = #"http://www.youtube.com/watch?v=FWKYriGgmCo";//(it's a workable link)
NSURL *url = [NSURL URLWithString:connectURL];
MVLCMovieViewController *movieViewController = [[MVLCMovieViewController alloc] init];
movieViewController.url = url;
[self presentModalViewController:movieViewController animated:YES];
[movieViewController release];
run the app, but i got a stop at http.c file with a hint "Program received signal "EXC_BAD_ACCESS"" near code:
p_sys->psz_user_agent = var_InheritString(p_access, "http-user-agent");
for(char *p = p_sys->psz_user_agent; *p, p++)
So does VLC support online playbacking? Or what should to be modified so that i can play a url directly on ios?
Thanks a lot for your help in advance!
I've done a lot of work on the VLC iOS source code, to try to get it to handle RTP and UDP streams. The short answer is that I didn't get it to work for those protocols but HTTP works, and the blocking seems to be at the OS level.
If you want the details on what I did to make VLC compile correctly and work on the latest XCode, please read the following forum thread https://forum.videolan.org/viewtopic.php?f=12&t=108691
Since YouTube seems to be HTTP, it should work but your mileage may vary.
Hope this helps.
Does anyone know how to play a facebook video in a UIWebView?
My app uploads video to facebook and retrieves the video's url. I'd like to embed this url into a UIWebView to play back. I've worked this out for youtube but not Facebook. looking for help.
Orpheus!
I’m a few years late lol, but I’ll post the answer here anyway -- in Swift since it’s 2018 ;) -- just in case someone needs it.
You can use the following HTML string:
let embedCode = "<iframe src=\"https://www.facebook.com/plugins/video.php?href=\([INSERT VIDEO URL])&show_text=0&width=\(Int([INSERT WIDTH]))\" width=\"\(Int([INSERT WIDTH]))\" height=\"\(Int([INSERT WIDTH] * 56.25))\" style=\"border:none;overflow:hidden\" scrolling=\”no\" frameborder=\"0\" allowTransparency=\”true\" allowFullScreen=\"true\"></iframe>"
where you replace [INSERT VIDEO URL] with the video URL and [INSERT WIDTH] with the desired web view width.
Then load the HTML into the UIWebView like so:
webView.loadHTMLString(embedCode, baseURL: nil)