Set up the PTMediaPlayer

The PTMediaPlayer interface encapsulates the functionality and behavior of a media player object.

Set up your PTMediaPlayer based on the example below.
// 1. Fetch the URL from UI, maybe in a text field.
NSURL  *url  =  [NSURL  URLWithString:textFieldURL.text];

// 2. Create PTMetadata.
//	Assume that the createMetada method prepares metadata (Described in Including advertising).
PTMetadata *metadata = [self createMetadata];

// 3. Create PTMediaPlayerItem using the PTMetadata instance created above. 
PTMediaPlayerItem *item = 
  [[[PTMediaPlayerItem alloc] initWithUrl:url mediaId:yourMediaID metadata:metadata] autorelease];

// 4. Add observers to notifications dispatched from the PSDK.
//	Assume that the addObservers method does that (Described in Set up notifications).
[self addObservers]

// 5. Create PTMediaPlayer using the PTMediaPlayerItem created above.
PTMediaPlayer *player = [PTMediaPlayer playerWithMediaPlayerItem:item];

// 6. Set properties on the player. For example: 
player.autoPlay = YES; 
player.closedCaptionDisplayEnabled = YES;
player.videoGravity = PTMediaPlayerVideoGravityResizeAspect; 
player.allowsAirPlayVideo = YES;

// 7. Set the player's view property.   
CGRect playerRect = self.adPlayerView.frame; 
playerRect.origin = CGPointMake(0, 0);
playerRect.size = CGSizeMake(self.adPlayerView.frame.size.width, self.adPlayerView.frame.size.height);

[player.view  setFrame:playerRect];
[player.view setAutoresizingMask:( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight  )];

// 8. Add the player's view in the current view's subview. 
[self.adPlayerView  setAutoresizesSubviews:YES]; 
[self.adPlayerView addSubview:(UIView *)player.view];

// 9. Call play on the player.
[player play];