2012-09-14 14 views
12

हैलो मेरे पास वेबव्यू के साथ ऐप है और मैं यूट्यूब वीडियो एम्बेड करता हूं। अब मेरे पास आईओएस 6 स्थापित है लेकिन वे अब और काम नहीं करते हैं।आईओएस 6 एम्बेड यूट्यूब

क्या किसी को पहले ही समाधान मिल गया है?

mycode:

- (void)viewDidLoad 
{ 
    [scrollvideoView setScrollEnabled:YES]; 
    [scrollvideoView setContentSize:CGSizeMake(320,2300)]; 
    [scrollvideoView setPagingEnabled:NO]; 

    [super viewDidLoad]; 
    // Do any additional setup after loading the view. 

    //Variabelen 
    NSInteger x1 = 25; 
    NSInteger x2 = 123; 
    NSInteger x3 = 220; 
    NSInteger sz = 75; 

    //Label height rij1 
    NSInteger yt1 = 45; 

    /* de Videos */ 
    //Eerste rij 
    NSInteger y1 = 0; 
    [self embedYouTube:@"http://www.youtube.com/watch?v=MFARZYEGqK8" frame:CGRectMake(x1, y1, sz, sz)]; 
    [self embedYouTube:@"http://www.youtube.com/watch?v=cD7WHGvXqEA" frame:CGRectMake(x2, y1, sz, sz)]; 
    [self embedYouTube:@"http://www.youtube.com/watch?v=8onqmHPBJOo" frame:CGRectMake(x3, y1, sz, sz)]; 

    //Setting de labels 
    UILabel *videoLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(x1, yt1, sz, sz)]; 
    videoLabel1.text = @"Videoclip daor heb ik schijt an"; 
    [self.scrollvideoView addSubview:videoLabel1]; 
    videoLabel1.backgroundColor = [UIColor clearColor]; 
    videoLabel1.font = [UIFont fontWithName:@"Arial" size: 9.0]; 
    videoLabel1.textColor = [UIColor whiteColor]; 

    UILabel *videoLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(x2, yt1, sz, sz)]; 
    videoLabel2.text = @"Videoclip goeie been verkeerde bed"; 
    [self.scrollvideoView addSubview:videoLabel2]; 
    videoLabel2.backgroundColor = [UIColor clearColor]; 
    videoLabel2.font = [UIFont fontWithName:@"Arial" size: 9.0]; 
    videoLabel2.textColor = [UIColor whiteColor]; 

    UILabel *videoLabel3 = [[UILabel alloc] initWithFrame:CGRectMake(x3, yt1, sz, sz)]; 
    videoLabel3.text = @"Wavin flag (giel beelen)"; 
    [self.scrollvideoView addSubview:videoLabel3]; 
    videoLabel3.backgroundColor = [UIColor clearColor]; 
    videoLabel3.font = [UIFont fontWithName:@"Arial" size: 9.0]; 
    videoLabel3.textColor = [UIColor whiteColor]; 

    //Tweede rij 
    NSInteger y2 = 100; 
    [self embedYouTube:@"http://www.youtube.com/watch?v=-cJz3YGRlMI" frame:CGRectMake(x1, y2, sz, sz)]; 
    [self embedYouTube:@"http://www.youtube.com/watch?v=ZdQRcAnPCvk" frame:CGRectMake(x2, y2, sz, sz)]; 
    [self embedYouTube:@"http://www.youtube.com/watch?v=KNcT5O1qk40" frame:CGRectMake(x3, y2, sz, sz)]; 

} 

- (void)embedYouTube:(NSString *)urlString 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, urlString, frame.size.width,`frame.size.height]; 
    UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame]; 
    [videoView loadHTMLString:html baseURL:nil]; 
    [self.scrollvideoView addSubview:videoView]; 
    //[videoView release]; 
} 
+2

आईओएस 6 की रिहाई टिप्पणी इसमें एक नोट इस बारे में है पढ़ें। –

+1

ऐप्पल ने मूल यूट्यूब ऐप को हटा दिया, जो वास्तव में पिछले आईओएस में यूट्यूब वीडियो चलाने में शामिल था। मैं एक प्रतिस्थापन खोजने की कोशिश कर रहा हूं, अभी तक कोई भाग्य नहीं है। –

+0

क्या आपने इसे हल किया था? – Daniel

उत्तर

11

महान प्रश्न और एक मुद्दा जो मैंने अभी देखा और समाधान खोजने के लिए बाहर था।

iOS 6 के रूप में, के http://www.youtube.com/watch?v=oHg5SJYRHA0 अब कार्य नहीं करेगा रूप में एम्बेडेड यूट्यूब यूआरएल:

मैं सफारी/वेबकिट धारा के तहत IOS 6 रिलीज नोट्स में इस उद्धरण मिला। ये यूआरएल यूट्यूब साइट पर वीडियो देखने के लिए हैं, न कि वेब पेजों में एम्बेड करने के लिए। इसके बजाए, प्रारूप का उपयोग किया जाना चाहिए यहां वर्णित है: https://developers.google.com/youtube/player_parameters

Google डेवलपर साइट पर वापस ऐसा लगता है कि वीडियो प्लेयर को आईफ्रेम का उपयोग करके एम्बेड किया जाना चाहिए, बहुत अधिक काम नहीं होना चाहिए।

उम्मीद है कि मदद करता है।

3

आप straigh आगे ऑटो-प्ले की जरूरत नहीं है, तो आप शायद आइफ्रेम प्ले बटन

 <iframe height="90" width="75" src="http://www.youtube.com/embed/VIDEOID"></iframe> 

,, फुलस्क्रीन जब आप खेलने के बटन दबाएँ साथ उपयोग कर सकते हैं खिलाड़ी लेता है (कम से कम आईओएस 6 में मेरे ऐप्स के लिए)

यदि आप पुराने बेस एसडीके 5.1 (5.0) के साथ ऐप संकलित करते हैं, तो किसी भी तरह का पुराना यूट्यूब एम्बेडिंग अभी भी आईओएस 6 में भी काम करना चाहिए। पसंद:

<embed src="http://www.youtube.com/watch?v=VIDEOID" type="application/x-shockwave-flash"  widht="64" height="64"></embed> 
+0

आपका क्या मतलब है 5.1 (5.0) देव किट? –

+3

पुराना बेस एसडीके, मैंने भ्रम को दूर करने के लिए इसे संपादित किया है। – PetrV

+0

बहुत बहुत धन्यवाद, मैंने इसे 5.0 एसडीके के रूप में उपयोग करके बनाया है और यह –

5

// Qiqi मदद से मैं के रूप में इस प्रकार है और यह मेरे लिए काम कर रहा है

// इस यूट्यूब की मेरी यूआरएल है iOS6 में यूट्यूब वीडियो निभाई है: http: //www.youtube.com/watch वी = s9KU-oOa6pA

// VIDEOID: s9KU-oOa6pA

 CGRect frame = CGRectMake(5,55, 310,200); 
    NSString *embedHTML =[NSString stringWithFormat:@"\ 
          <html><head>\ 
          <style type=\"text/css\">\ 
          body {\ 
          background-color: transparent;\ 
          color: blue;\ 
          }\ 
          </style>\ 
          </head><body style=\"margin:0\">\ 
          <iframe height=\"200\" width=\"310\"  src=\"http://www.youtube.com/embed/s9KU-oOa6pA\"></iframe>\ 
          </body></html>"]; 
    UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame]; 

    videoView.backgroundColor = [UIColor clearColor]; 
    [videoView loadHTMLString:embedHTML baseURL:nil]; 
    [self.view addSubview:videoView]; 

 संबंधित मुद्दे

  • कोई संबंधित समस्या नहीं^_^