Tag: youtube

查看YTPlayer的大小

我正在使用iOS YouTube Player帮手( https://developers.google.com/youtube/v3/guides/ios_youtube_helper ),它工作得很好,但预览图像不是我的视图的大小,我无法弄清楚如何改变它,使之适合我创build的UIView。 我怎样才能填补这个观点? 这是它的样子。

如何在AVPlayer IOS中使用URL播放YouTubevideo?

我想在AVPlayer中使用YouTube URL加载video,但它没有显示任何东西。每当我从本地存储使用NSBundle加载它工作正常。是有任何替代加载video或我们可以在AVPlayer中做的事情。 这是我的代码: – (void)viewDidLoad { [super viewDidLoad]; NSError *setCategoryError = nil; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error: &setCategoryError]; AVAsset *asset = [AVAsset assetWithURL:[NSURL fileURLWithPath:@"http://www.youtube.com/watch?v=zPP6lXaL7KA&feature=youtube_gdata_player"]]; avPlayerItem = [[AVPlayerItem alloc]initWithAsset:asset]; self.songPlayer = [AVPlayer playerWithPlayerItem:avPlayerItem]; self.avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer: self.songPlayer]; self.avPlayerLayer.frame = self.view.layer.bounds; UIView *newView = [[UIView alloc] initWithFrame:self.view.bounds]; [newView.layer addSublayer:avPlayerLayer]; [self.view addSubview:newView]; [ self.songPlayer play]; }

MPMoviePlayerController错误_itemFailedToPlayToEnd同时播放YouTubevideo的iOS 7

我已经看到这提到了networking上的一些地方,但还没有find答案的任何地方。 我正在使用ALMovieplayercontroller库。 一切工作正常,但是当我试图播放Youtubevideo,它给了我错误。 _itemFailedToPlayToEnd:{kind = 1; 新= 2; 旧= 0; } 编辑 – (void)setContentURL:(NSURL *)contentURL { self.movieSourceType = MPMovieSourceTypeStreaming; [super setContentURL:contentURL]; [[NSNotificationCenter defaultCenter] postNotificationName:ALMoviePlayerContentURLDidChangeNotification object:nil]; [self play]; } 这是我的代码 ALMoviePlayerControls *movieControls = [[ALMoviePlayerControls alloc] initWithMoviePlayer:self.moviePlayer style:ALMoviePlayerControlsStyleDefault]; //[movieControls setAdjustsFullscreenImage:NO]; [movieControls setBarColor:[UIColor colorWithRed:195/255.0 green:29/255.0 blue:29/255.0 alpha:0.5]]; [movieControls setTimeRemainingDecrements:YES]; //assign controls [self.moviePlayer setControls:movieControls]; [self.view addSubview:self.moviePlayer.view]; self.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming; […]

iOS 8的YouTubevideoembedded

我面临着我似乎无法理解的问题。 我有这个代码在iOS 7的Xcode 5中完美的工作: – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. CGFloat width = self.view.frame.size.width; CGFloat height = self.view.frame.size.height; UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; NSString* embedHTML = @"\ <html><head><meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; user-scalable=0;\"/>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: […]

youtube.com上的video如何在iOS上自动播放

当我在我的网站上将YouTubevideo(IFrame API)的自动播放设置为true时,它不起作用。 所有的文件说,苹果因带宽原因禁用ios的自动播放。 不过,我发现iPad上的youtube.com会自动播放video(无需点击video元素)。 YouTube如何运作? 很难想象苹果会为YouTube做些特别的事情。

如何在UIWebview中获取当前正在播放的video的url

有什么办法可以得到当前正在播放的video的链接。我正在加载m.youtube.com 。对于一些video,它甚至不进入代表。我也尝试使用NStimer。但是对于一些video,它不是点击url

YouTubeembedded的UIWebViews不再适用于iOS

我有一段时间的应用程序,它使用UIWebView在某些视图上显示YouTubevideo。 今天,没有任何代码的变化,我的用户开始抱怨YouTube的embedded不工作:与静止框架和播放button的embedded显示正常,但点击播放button时,embedded屏幕变黑,没有加载,没有声音或video。 这里是我的函数来生成一个embedded代码从YouTube ID放入UIWebView : + (NSString*)codeForYouTubeID:(NSString*)videoID width:(NSUInteger)width height:(NSUInteger)height { static NSString *fmt = @"<iframe width='%d' height='%d' src='http://www.youtube.com/embed/%@?showinfo=0&modestbranding=1&rel=0&showsearch=0' frameborder='0' scrolling='0' allowfullscreen></iframe>"; return [NSString stringWithFormat:fmt, width, height, videoID]; } 将生成的代码放入JSFiddle中 ,embedded显示并播放正常。 我也使用了下面的替代格式string与相同的结果(从这里 StackOverflow的答案): static NSString *fmt = @"<object>\ <param name=\"movie\" value=\"http://www.youtube.com/v/%@\"></param>\ <embed src=\"http://www.youtube.com/v/%@\" type=\"application/x-shockwave-flash\"></embed>\ </object>"; 这有相同的结果,但有一个笨拙的自动大小的embedded。 行为是一样的:用户可以点击播放button,然后embedded框架变黑,没有其他事情发生。 对我来说,这是发生在我的testing手机(iPhone 4,iOS 7)和模拟器(iOS6和7)上。 这在今天之前没有发生,没有代码已经改变。 有谁最近经历过这个?

使youtube.com/embedurl适用于iOS

对于YouTube上的某个video,您可以访问任何iOS设备上的http://youtube.com/watch?v= [代码]以查看video。 不过,如果您使用http://youtube.com/embed/[code]url(例如,在网页上的iframe或Colorbox模式中),则无法在iOS上播放。 例如,如果你使用这样的代码: <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0"> 你只是看到一个错误: 您的浏览器目前不能识别任何可用的video格式。 点击这里访问我们关于HTML5video的常见问题。 为了增加伤害,链接不能在iOS上点击,所以我不知道要去哪个页面。 YouTube上有一个HTML5页面 ,但没有说明什么特别有用或令人惊讶。 有一种语法,可以为iframeembedded在iOS上按预期工作吗?

如何在iPhone中的应用程序内播放youtube / vimeovideo

我正在build立一个应用程序,我想要从像Youtube,Vimeo,直接url的URL播放video。 我正在使用AVPlayer自定义播放器从video剪辑的直接url(如www.abc/play.mp4)播放video。 但后来我遇到了一个很大的问题,玩YouTube和VIMEOvideo。 search了很多后,我发现这些链接,它说,不使用UIWebview我不能播放Youtube链接: 使用MPMoviePlayerController而不是UIWebView播放YouTubevideo 在没有UIWebView的情况下从YouTube链接播放video 所以我只是使用这个代码: NSString *youTubeVideoHTML = @"<html><head><style>body{margin:0;}</style></head> <body> <div id=\"player\"></div> <script> var tag = document.createElement('script'); tag.src = 'http://www.youtube.com/player_api'; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; function onYouTubePlayerAPIReady() { player = new YT.Player('player', { width:\'100%%\', height:'200px', videoId:\'%@\', events: { 'onReady': onPlayerReady } }); } function onPlayerReady(event) { event.target.playVideo(); } </script> </body> […]

Youtubevideo上传使用NSURLRequest

我正尝试使用NSURLRequest将video上传到YouTube。 我能够validation和用户和video上传,当检查它说失败(无法转换video文件)我不知道该怎么做,请usggest 构build请求 Authorization = "Bearer ya29.AHES6ZTQ3rJZaf2g3pIYa_7_myg1N_GvQ4VdmJIcapfoqKIfQf-Iow"; Connection = close; "Content-Length" = 1848078; "Content-Type" = "multipart/related; boundary=217NH17UDP"; "GData-Version" = 2; Host = "uploads.gdata.youtube.com"; Slug = "videoFile.mp4"; "X-GData-Key" = "key=AI39si4b-ta8ku-hbsLt73O0rIlOBjpHbITt8WGrwL7OevwjNjl5EFcowlJlBM6kp3rrU1cw64Vobp1l1lJP31Rqavshl4962A"; –217NH17UDP Content-Type: application/atom+xml; charset=UTF-8 <?xml version="1.0"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"> <media:group> <media:title type="plain">Sample Video File</media:title> <media:description type="plain"> Description of the sample video </media:description> <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Music </media:category> […]