0

동영상 플레이어의 볼륨 막대를 숨기고 다른 컨트롤이 계속 나타나도록하려면 (재생, 앞으로 ...)? 나는 어떤 소리도 내지 않는 비디오를 보여주기를 원하기 때문에 볼륨 바는 완전히 쓸모가 없다.동영상 플레이어의 볼륨 막대 숨기기

이 작업을 수행 할 수 있습니까? 사전

답변

1

에서

덕분에 MPMoviePlayerMPMovieControlStyleNone에의 controlStyle 설정합니다.

moviePlayer.controlStyle = MPMovieControlStyleNone; 

그러나보기에서 모든 컨트롤이 숨겨집니다.

MPMovieControlStyleNone으로 설정 한 후 재생/일시 중지 옵션을 표시하고 검색 표시 줄을 표시하려면 사용자 지정 컨트롤을 추가해야합니다. (줄을 추구하고 도구 모음 단추와 함께 UIToolBar에 배치로 내가 전에 그것을했다, 나는 슬라이더를 사용했다. 버튼 재생을위한/일시 정지 옵션)

MPMovieControlStyle을

상수 설명 재생 컨트롤의 스타일.

ENUM {MPMovieControlStyleNone, MPMovieControlStyleEmbedded,
MPMovieControlStyleFullscreen, MPMovieControlStyleDefault = MPMovieControlStyleFullscreen}; typedef NSInteger MPMovieControlStyle;

상수

MPMovieControlStyleNone

No controls are displayed. 

Available in iOS 3.2 and later. 

Declared in MPMoviePlayerController.h. 

전체 화면 내장형 디스플레이 모드 사이

Controls for an embedded view are displayed. The controls include a start/pause button, a scrubber bar, and a button for toggling 

을 MPMovieControlStyleEmbedded. 버튼을 추구

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. 
, 디스플레이 모드, 애스펙트 충전 모드를 전환하기위한 버튼, 및 완료 버튼을 전체 화면 간을 전환하고 내장하는 버튼. 완료 버튼을 누르면 비디오가 일시 정지되고 전체 화면 모드가 종료됩니다.

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. 

"해킹"파단를 제외하고이 작업을 수행 할 수있는 방법이 없습니다 MPMoviePlayerController

+0

응답 해 주셔서 감사합니다. 그러나 위에서 언급 한 것처럼, MPMovieControlStyleNone을 사용하면 모든 컨트롤이 숨겨지고 확실히 만들지 않을 것입니다. 볼륨 바를 숨기고 싶습니다 (시뮬레이터에 표시되는 것과 동일), 다른 접근 방법을 사용합니까? –

+0

@MuhannadDasoqie : 답변을 업데이트했습니다. –

0

를 참조하십시오. MPMoviePlayerViewController를 서브 클래스 화하고 서브 뷰를 반복 할 수 있습니다.내 애플 리케이션 중 하나, 나는 미디어 컨트롤 같은 것들을 제거하려면이 같은 코드를 사용 : 위의 코드는, 그것은 아이폰 OS 4.3으로 너무 오래된 일입니다

- (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 5 및 iOS 6에서는보기 계층이 변경되었으므로 모든 새로운 iOS 버전으로 코드를 업데이트해야 할 수도 있습니다. 또한 : MPMoviePlayerController hide volume slider

+0

첨부 된 링크와 관련하여 응답을 위해 Thnx를 사용해 보았지만 불행히도 작동하지 않으며 Xcode에서 MPVolumeSlider "symbol not found"에 대한 오류를 표시합니다! 나는 당신의 코드를 시험해보고 돌아올 것입니다. –

+0

iOS 5 나 iOS 6에서 클래스 이름을 찾으려면 역 엔지니어링을해야합니다 :-) –