3
你好,我正面臨一個與添加子視圖有關的問題; 我下面的代碼:如何將videoPlayer添加爲子視圖?
NSString *urlStr = [NSString stringWithFormat:@"http:x/iphone0.m3u8"];
NSURL *videoURL = [NSURL URLWithString:urlStr];
MPMoviePlayerController *iVideoPlayer = [[MPMoviePlayerController alloc]initWithContentURL:videoURL];
[self.view addSubview:iVideoPlayer.view ];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// The device is an iPad running iPhone 3.2 or later.
iVideoPlayer.view.frame = CGRectMake(353,258,320,240);
}
else
{
iVideoPlayer.view.frame = CGRectMake(156,96,168,148);
}
[iVideoPlayer play];
在這段代碼我想補充一個視頻播放器作爲一個子視圖。我已經成功添加了videoPlayer.but問題是,在視頻播放期間,如果點擊指定區域(CGRectMake(353,258,320,240);視頻停止。我喜歡應用videoPlayer功能(下一個,暫停,音量調高/調低) 如何解決這個問題?
下面的答案有幫助嗎? – Ryan