Youtube videos in app

2

How to embed a video from my YouTube channel to an app in iOS ?

I followed this guide of YouTube Developers , but the video does not appear on the screen.

My code looks like this:

FirstViewController.h

//
//  FirstViewController.h
//  GaleRio
//
//  Created by Alex on 25/11/14.
//  Copyright (c) 2014 Creapix Tecnologia Criativa. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "YTPlayerView.h"


@interface FirstViewController : UIViewController


@property(nonatomic, strong) IBOutlet YTPlayerView *playerView;

@end

FirstViewController.m

//FirstViewController.m
//  GaleRio
//
//  Created by Alex on 25/11/14.
//  Copyright (c) 2014 Creapix Tecnologia Criativa. All rights reserved.
//

#import "FirstViewController.h"


@interface FirstViewController ()

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.playerView loadWithVideoId:@"M7lc1UVf-VE"];


    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

The links in the storyboard were made correctly, I think the problem is in the ID of the video on youtube.

EDIT: I've tried solution from Lucas did not go any further.

Note: code available in full here .

    
asked by anonymous 28.11.2014 / 00:08

1 answer

0

You just needed to include the YTPlayerView-iframe-player.html file within the Assets directory using the Create folder references option as described in the documentation .

The step mentioned by Lucas Eduardo is optional to make it work.

    
15.01.2015 / 19:58