将youtube视频上传到JW Player

时间:2014-01-02 15:35:17

标签: objective-c

我正在尝试使用JW.player在我的应用中显示YouTube视频,但是当我按下播放时没有任何反应。我可以在我的UIWebView中看到viewcontroller,但视频未出现怎么样?

- (void)viewDidLoad
{
    [super viewDidLoad];
    htmlPlayerWebView =[ [UIWebView alloc]initWithFrame:CGRectMake(0, 51, 674,381)];
    [self.view addSubview:htmlPlayerWebView];
}

-(void)loadVideo
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"home" ofType:@"html"];
    NSString *HTMLString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
    [htmlPlayerWebView loadHTMLString:HTMLString baseURL:[NSURL URLWithString:path]];
}

HTML代码:

<html>
    <head>
        <title>Title of the document</title>
        <script src="http://jwpsrv.com/library/NwqHmnPBEeORiiIACmOLpg.js"></script>
    </head>
    <body>
        <div id='playerNtFziJDGyTtg'></div>
        <script type='text/javascript'>
        jwplayer('playerNtFziJDGyTtg').setup({
            file: 'https://www.youtube.com/watch?v=ac7KhViaVqc',
            title: 'Sintel | first official trailer US (2010) 3D open movie project',
            width: '360',
            height: '640',
            fallback: 'false'
        });
        </script>
    </body>
</html>

0 个答案:

没有答案