Youtube videos on app

Asked

Viewed 136 times

2

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

Follow this guide of Youtube Developers, but the video does not appear on the screen.

Man code is 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 ID video on youtube.

EDIT: I tried to solution of Lucas but it didn’t help.

Note: code available in full here.

  • the link between your Iboutlet and the class is well made?

  • The solution proposed by me did not work?

1 answer

0


It was only necessary to include the file YTPlayerView-iframe-player.html within the Directory Assets using the option Create Folder Ferences as described in the documentation.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.