Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 14, 2012, 01:13 PM   #1
RagingGoat
macrumors regular
 
Join Date: Jun 2010
Embedded YouTube Video in Landscape

I have an app that is locked into portrait orientation but I have an embedded YouTube video that I want to play in landscape when the user hits play on the thumbnail. Can anyone help me out with this? Maybe point me in the right direction?

Code:
//
//  YouTubeView.h
//  KFBNewsroom
//
//  Created by KFB on 11/8/12.
//  Copyright (c) 2012 com.kfb. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface YouTubeView : UIViewController
{
    IBOutlet UIWebView *thumbnailView;
}
@property (nonatomic, retain) IBOutlet UIWebView *thumbnailView;

@end
Code:
//
//  YouTubeView.m
//  KFBNewsroom
//
//  Created by KFB on 11/8/12.
//  Copyright (c) 2012 com.kfb. All rights reserved.
//

#import "YouTubeView.h"

@interface YouTubeView ()

@end

@implementation YouTubeView
@synthesize thumbnailView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"Monthly Video";
    // Do any additional setup after loading the view from its nib.
    // webView is a UIWebView, either initialized programmatically or loaded as part of a xib.
    
    NSString *htmlString = @"<html><head><meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 280\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"280\" height=\"218\"><param name=\"movie\" value=\"http://www.youtube.com/embed/videoseries?list=PL0B9BF37A24840E28&amp;hl=en_US""></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/embed/videoseries?list=PL0B9BF37A24840E28&amp;hl=en_US""type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"280\" height=\"218\"></embed></object></div></body></html>";
    
    [thumbnailView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com/playlist?list=PL0B9BF37A24840E28&feature=plcp"]];

}

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

@end
RagingGoat is offline   0 Reply With Quote
Old Nov 14, 2012, 02:45 PM   #2
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
supportedInterfaceOrientations
dejo is offline   0 Reply With Quote
Old Nov 14, 2012, 02:55 PM   #3
RagingGoat
Thread Starter
macrumors regular
 
Join Date: Jun 2010
I'll check that out. Thanks!
RagingGoat is offline   0 Reply With Quote
Old Nov 14, 2012, 03:07 PM   #4
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
I take it you haven't followed my advice yet and read through the View Controller Programming Guide?
__________________
dejo is offline   0 Reply With Quote
Old Nov 14, 2012, 03:31 PM   #5
RagingGoat
Thread Starter
macrumors regular
 
Join Date: Jun 2010
I've started looking at it but haven't gotten through it yet.
RagingGoat is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Embedded YouTube Video Thumbnail Flashes Red RagingGoat iPhone/iPad Programming 2 Nov 19, 2012 02:13 PM
Embedded YouTube videos not working on wifi DoctorR4ge iPhone Tips, Help and Troubleshooting 0 Nov 10, 2012 03:43 PM
Embedded YouTube videos not working iDabble MacBook Pro 2 Oct 2, 2012 02:36 PM
Embedded YouTube videos not working??? Mercennarius iOS 6 1 Sep 22, 2012 10:43 AM
Reeder displaying embedded Youtube videos eadmnc Mac Applications and Mac App Store 3 Sep 1, 2012 11:15 AM

Forum Jump

All times are GMT -5. The time now is 08:23 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC