2013-03-06 92 views
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。哪裏來的,以及如何擺脫這一點。

+0

重複http://stackoverflow.com/questions/4107217/uiwebview-intercept-setting-movie的-path-from-javascript-audio-player和 – 2013-03-06 17:15:54

回答

1

設置影片路徑:

它來自JavaScript的音頻播放器,這是在youtube.com。

2

以下是將stderr重定向到緩衝區的一種可能方式,該緩衝區允許您過濾出特定的消息(但是,個人而言,它看起來比其價值更麻煩......但另一方面,這些消息可能會使調試變得煩人) :Turn off console logging for specific objects

擴大對@ 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]); 
    });