回答
設置MPMoviePlayer
到MPMovieControlStyleNone
的controlStyle
。
moviePlayer.controlStyle = MPMovieControlStyleNone;
但是這會隱藏視圖中的所有控件。
設置爲MPMovieControlStyleNone
之後,如果要顯示播放/暫停選項並查找欄,則需要添加自定義控件。 (我以前做過,我用滑塊爲搜索欄和並把它放在一個UIToolBar
與工具欄按鈕一起。按鈕是播放/暫停選項)
MPMovieControlStyle
常量描述播放控件的樣式。
枚舉{MPMovieControlStyleNone,MPMovieControlStyleEmbedded,
MPMovieControlStyleFullscreen,MPMovieControlStyleDefault = MPMovieControlStyleFullscreen}; typedef NSInteger MPMovieControlStyle;常量
MPMovieControlStyleNone
No controls are displayed. Available in iOS 3.2 and later. Declared in MPMoviePlayerController.h.
MPMovieControlStyleEmbedded
Controls for an embedded view are displayed. The controls include a start/pause button, a scrubber bar, and a button for toggling
全屏和嵌入式顯示模式之間。
Available in iOS 3.2 and later. Declared in MPMoviePlayerController.h.
MPMovieControlStyleFullscreen
Controls for fullscreen playback are displayed. The controls include a start/pause button, a scrubber bar, forward and reverse
求按鈕,用於全屏之間切換和嵌入式 顯示模式,用於切換方面填充模式的按鈕,以及完成 按鈕的按鈕。點擊完成按鈕可暫停視頻並退出全屏模式 。
Available in iOS 3.2 and later. Declared in MPMoviePlayerController.h.
MPMovieControlStyleDefault
Fullscreen controls are displayed by default. Available in iOS 3.2 and later. Declared in MPMoviePlayerController.h.
有沒有辦法做到這一點,除了 「黑客」 子視圖。你可以繼承MPMoviePlayerViewController並迭代子視圖。在我的應用程序之一,我用這樣的代碼來刪除諸如媒體控制的事情:
- (void)removeMediaControls
{
@try
{
// Search for the MPSwipeableView
for (UIView *view1 in [self.view subviews])
{
// Check for the MPSwipeableView
if ([[[view1 class] description] isEqualToString:@"MPSwipableView"])
{
// Search for the MPVideoBackgroundView
for (UIView *view2 in [view1 subviews])
{
// Check for the MPVideoBackgroundView
if ([[[view2 class] description] isEqualToString:@"MPVideoBackgroundView"])
{
// Search for the UIView
for (UIView *view3 in [view2 subviews])
{
// Check for the MPWildcatFullScreenVideoOverlay
if ([[[view3 class] description] isEqualToString:@"MPWildcatFullScreenVideoOverlay"])
{
// Search for the MPWildcatFullScreenNavigationBar
for (UIView *view4 in [view3 subviews])
{
// Check for the UIImageView
if ([[[view4 class] description] isEqualToString:@"UIImageView"])
{
// Remove the overlay
[view4 removeFromSuperview];
}
}
}
}
}
}
}
}
}
@catch (NSException * e)
{
}
}
上面的代碼太舊了,它與iOS 4.3的工作。在iOS 5和iOS 6上,視圖層次結構發生了變化,因此您可能必須使用每個新的iOS版本更新您的代碼。另請參閱:MPMoviePlayerController hide volume slider
thnx爲響應,關於附加鏈接,我已經嘗試過,但不幸的是它不起作用,並且Xcode顯示關於MPVolumeSlider「符號未找到」的錯誤!我會嘗試你的代碼並回來 –
你必須做一些反向工程來找出iOS 5或iOS 6上的類名,:-) –
- 1. 隱藏音頻播放器
- 2. pyqt在聲音播放器QT4.9中播放電影文件
- 3. 電影播放器控件顯示/隱藏時的通知?
- 4. 如何在iphone中設置電影播放器中的音量靜音?
- 5. 媒體播放器未播放時如何隱藏搜索欄?
- 6. 電影播放器Android
- 7. iOS 5電影播放器
- 8. 播放電影停止avcapturesession錄音
- 9. 使用MPMoviePlayerController播放電影時隱藏狀態
- 10. 如何在播放MPMoviePlayerController電影之前隱藏控件?
- 11. Swift中的電影播放器
- 12. UIWebView中的電影播放器
- 13. 隱藏MediaElement.js播放器
- 14. 如何隱藏播放器中的音樂href?
- 15. 如何隱藏網絡播放器中的音樂地址?
- 16. JWPlayer隱藏時無法播放音頻
- 17. Fancybox中的JW播放器。無法隱藏控制欄
- 18. 播放視頻時隱藏控制欄
- 19. iPhone - 播放電影后,播放音頻效果不佳
- 20. sencha touch:如何播放音頻並從視圖中隱藏播放器
- 21. 在Excel中播放電影
- 22. 電影儘管處於靜音模式下的音頻播放?
- 23. mediaelement音頻播放器音量滑塊在播放器下面
- 24. 隱藏HTML 5音頻播放器的源URL
- 25. c#在windows媒體播放器中播放電影「不」嵌入
- 26. JW播放器控制欄自動隱藏並再次播放按鈕
- 27. 在電影中的所有按鈕的翻轉播放聲音
- 28. 播放1.2.4:檢索控制器中的隱藏變量值
- 29. 在隱藏媒體播放器之前,如何讓代碼等待AVI電影完成播放? Visual Basic 6
- 30. 新視圖控制器中的電影播放器不能播放來自動態url的電影iPhone iOS
感謝您的迴應,但正如您在上面提到的那樣,如果我將使用MPMovieControlStyleNone,它將隱藏所有控件,當然我不想這樣做。只是我想要隱藏音量欄(它在模擬器上顯示的一樣),你有另一種方法嗎? –
@MuhannadDasoqie:我已經更新了答案,請檢查。 –