【问题标题】:How to only get the audio of YouTube videos running?如何只让 YouTube 视频的音频运行?
【发布时间】:2012-04-25 23:31:04
【问题描述】:

我遇到了一个相当奇怪的问题。我现在要做的只是获取给定链接的 YouTube 视频的音频。我尝试了几件事,但要么没用,要么效率不高。

因此,我决定在这里询问更有经验的 iOS 开发人员。提前致谢。

@implementation ViewController
@synthesize web;

- (void)embedYouTube:(NSString*)url frame:(CGRect)frame{
        NSString* embedHTML = @"<html><head> <style type=\"text/css\">body {background-color: transparent;color: white;}</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" width=\"%0.0f\" height=\"%0.0f\"></embed></body></html>";
        NSString* html = [NSString stringWithFormat:embedHTML, url, frame.size.width, frame.size.height];

        UIWebView *webView =[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
        [webView loadHTMLString:html baseURL:nil];
        [self.view addSubview:webView];
}

-(IBAction)play{

    [self embedYouTube:@"http://www.youtube.com/watch?v=iw1aT5c1Lus" frame:CGRectMake(0, 0, 320, 480)];

}

【问题讨论】:

    标签: ios performance cocoa-touch youtube video-streaming


    【解决方案1】:

    只用你的媒体播放器播放视频,但不要给它一个帧,这将播放音频,但不加载图像

    【讨论】:

    • 感谢您的回答。我已经更改了网页的框架并嵌入了 Youtube 框架,但它没有用。我上传了我的代码。再次感谢
    • 还是不行请你帮帮我吗?
    猜你喜欢
    • 2013-03-02
    • 1970-01-01
    • 2013-11-10
    • 2015-11-06
    • 1970-01-01
    • 2020-08-29
    • 1970-01-01
    • 2022-01-24
    • 2011-05-29
    相关资源
    最近更新 更多