2

I want to play YouTube video in UIWebView, I followed so many links and I am able to embed videos in UIWebView but the problem is sometimes it will show the message This video contains contents from Vevo

But I found that whatever iFrame I am using it is working perfectly in browser using firebug.

This is the iFrame which I using in browser

<iframe id="player" type="text/html" width="320" height="300" src="https://www.youtube.com /embed/w4s6eUZ2uGw?enablejsapi=1&origin=http://example.com" frameborder="0"></iframe>

The same iFrame I am using in iOS device

<iframe id=\"player\" type=\"text/html\" width=\"320\" height=\"300\" src=\"https://www.youtube.com/embed/w4s6eUZ2uGw?enablejsapi=1&origin=http://example.com\" frameborder=\"0\"></iframe>

[self.videoView loadHTMLString:embedHTML baseURL:nil];

Please tell me if I am doing wrong anywhere.

Screen Shot

enter image description here

Ashish Tiwari
  • 2,168
  • 4
  • 30
  • 54
  • Try This Link,I hope this will help full for you. http://stackoverflow.com/questions/18873203/embed-youtube-video-in-ios-app/18873523#18873523 – Naveen kumar Nov 05 '14 at 12:36

2 Answers2

0

In case someone finds this later. SME is Sony Music Entertainment. This message means that a song or something in the video is infringing on Sony's copyrights. Because of this they will not let the video be embedded. If you have rights to play the video you can file a counter claim and prove that you legally can embed and share a video that contains Sony Music Entertainment content.

Tyler F
  • 101
  • 1
  • 7
-1
UIWebView * youTubeWebView=[[UIWebView alloc]initWithFrame:CGRectMake(0,0,320,320)];
    youTubeWebView.allowsInlineMediaPlayback=YES;
    youTubeWebView.mediaPlaybackRequiresUserAction=NO;
    youTubeWebView.mediaPlaybackAllowsAirPlay=YES;
    youTubeWebView.delegate=self;
    youTubeWebView.scrollView.bounces=NO;

    NSString *linkObj=@"http://www.youtube.com/v/1iBIcJFRLBA";//@"http://www.youtube.com/v/6MaSTM769Gk";
    NSLog(@"linkObj1_________________%@",linkObj);
    NSString *embedHTML = @"\
    <html><head>\
    <style type=\"text/css\">\
    body {\
    background-color: transparent;color: white;}\\</style>\\</head><body style=\"margin:0\">\\<embed webkit-playsinline id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \\width=\"320\" height=\"320\"></embed>\\</body></html>";

    NSString *html = [NSString stringWithFormat:embedHTML, linkObj];
    [youTubeWebView loadHTMLString:html baseURL:nil];
    [self.view addSubview:youTubeWebView];
Naveen kumar
  • 800
  • 1
  • 5
  • 23