Question

I came upon a video player framework to replace default video player in my Xcode iPhone project, ign VideoPlayerKit: https://github.com/ign/VideoPlayerKit

It looks great and I made it to work, but I can't manage to embed the video inline in my app main view like on the GitHub's first screenshot (videoplayer with tableview beneath).

Here's what my main view files look like:

// ViewController.h

#import
#import "VideoPlayerKit.h"

@interface ViewController : UIViewController

@property (nonatomic) BOOL fullScreenToggled;

@end

And:

// ViewController.m

#import "ViewController.h"

@interface ViewController ()

@property (nonatomic, strong) VideoPlayerKit *ViewController;

@end

@implementation ViewController

    (id)init { if ((self = [super init])) { } return self; }

// Fullscreen / minimize without need for user's input

    (void)fullScreen
    {
    if (!self.ViewController.fullScreenModeToggled) {
    [self.ViewController launchFullScreen];
    } else {
    [self.ViewController minimizeVideo];
    }
    }

    (void)playVideo
    {

    NSURL *url = [NSURL URLWithString:@"http://mystream.m3u8"];

    self.ViewController = [VideoPlayerKit videoPlayerWithContainingViewController:self optionalTopView:NO hideTopViewWithControls:YES];

    [self.ViewController playVideoWithTitle:@"Title" URL:url videoID:nil shareURL:nil isStreaming:NO playInFullScreen:YES];

}

    (void)viewDidLoad
    {
    [super viewDidLoad];
    }

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

@end

What I'm missing or doing wrong?

Was it helpful?

Solution

I found you need to set the frame of the view

self.ViewController.view.frame=CGRectMake(10.0f,10.0f,200.0f,200.0f);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top