1

我在我的应用程序中嵌入了一个 youtube 链接,如下所示

- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frameSize inView:(UIImageView*)imageView {
    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, urlString, frameSize.size.width, frameSize.size.height];
    videoView       = [[UIWebView alloc] initWithFrame:frameSize];
    [videoView loadHTMLString:html baseURL:nil];
    [imageView  addSubview:videoView];

}

但是,当我播放视频并且控制台正在向我抛出如下所示的长时间测试时

setting movie path: http://r20---sn-tt17rn7s.c.youtube.com/videoplayback?fexp=917000%2C906357%2C923121%2C914071%2C916624%2C920704%2C912806%2C902000%2C922403%2C922405%2C929901%2C913605%2C925006%2C906938%2C931202%2C908529%2C904830%2C920201%2C930101%2C930603%2C906834%2C926403%2C913570%2C901451&newshard=yes&cp=U0hVR1ZMUF9GS0NONV9ORlRDOlZKNFRXTmNDY2NS&sver=3&itag=18&mt=1362588975&id=6e1254edbdac474b&ms=au&mv=m&source=youtube&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&ipbits=8&ratebypass=yes&expire=1362612211&ip=66.207.201.14&key=yt1&upn=3o0EU_taOns&cpn=6QDoUVzCQUiAeBqm&signature=C609660EDEB083FFC1ABD1F781EDA222B6F04C66.CA4A052F0E17C10D866EB3D302A258571322C185  

我确实setting move path在我的代码中进行了搜索,但是no recored found. 到底是从哪里来的,以及如何摆脱它。

4

2 回答 2

2

这是一种将 stderr 重定向到缓冲区的可能方法,该缓冲区允许您过滤掉特定消息(但就个人而言,这看起来比它的价值更麻烦......但另一方面,这些消息可能会使调试变得烦人):关闭控制台记录特定对象

扩展@detunized的答案(不过我还没有测试过):

bool should_show(char *buffer) {
    return !stncmp("setting movie path", buffer, 18); // untested code...
}

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^(void) {
        size_t const BUFFER_SIZE = 2048;

        // Create a pipe
        int pipe_in_out[2];
        if (pipe(pipe_in_out) == -1)
            return;

        // Connect the 'in' end of the pipe to the stderr
        if (dup2(pipe_in_out[1], STDERR_FILENO) == -1)
            return;

        char *buffer = malloc(BUFFER_SIZE);
        if (buffer == 0)
            return;

        for (;;)
        {
            // Read from the 'out' end of the pipe
            ssize_t bytes_read = read(pipe_in_out[0], buffer, BUFFER_SIZE);
            if (bytes_read <= 0)
                break;

            // Filter and print to stdout
            if (should_show(buffer)) // TODO: Apply filters here
                fwrite(buffer, 1, bytes_read, stdout);
        }

        free(buffer);
        close(pipe_in_out[1]);
    });
于 2013-03-06T17:15:13.910 回答
1

设置电影路径:

它来自 youtube.com 中的 javascript 音频播放器。

于 2013-03-06T17:07:44.257 回答