Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)loadwebViewToPlay {
- NSString * videoHtml = @"<html><head><style>body{margin:0px 0px 0px 0px;}</style></head> <body> <div id="player"></div> <script> var tag = document.createElement('script'); tag.src = 'http://www.youtube.com/player_api'; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; function onYouTubePlayerAPIReady() { player = new YT.Player('player', { width:'200', height:'200', videoId:'bHQqvYy5KYo', events: { 'onReady': onPlayerReady } }); } function onPlayerReady(event) { event.target.playVideo(); } </script> </body> </html>";
- UIWebView * webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
- webview.backgroundColor = [UIColor clearColor];
- webview.opaque = NO;
- //videoView.delegate = self;
- [self.view addSubview:webview];
- webview.mediaPlaybackRequiresUserAction = NO;
- [webview loadHTMLString:videoHtml baseURL:[[NSBundle mainBundle] resourceURL]];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement