본문 바로가기

IT_Story/안드로이드

안드로이드 MediaController Custom

요새 비디오 재생(연속재생) 때문에 VideoView, Controller를 좀 만지고 있는데

기존에는 그냥 대충 기본으로만 만들다가 custom하게 만드려니까 헷갈릴만한 부분이 있다.



1.

CustomMediaController extends MediaController 라고 해도

빨리감기, 되감기(15초) 버튼은 보여지게 된다.


안드로이드에서 제공해주는 기본이 15초 빨리,되감기이며


new MediaController(Context, boolean) 을 통해서 버튼을 사용하지 않을 수 있다.

문서에 아래와 같이 써있다.


The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false


2.

그리고 MediaController.setEnabled(boolean) 을 통해서

빨리/되감기 말고 이전 영상, 다음 영상으로 넘길 때의 버튼들도 변경할 수 있다.


3.

또한, 빨리/되감기 클릭리스너도 달아줄 수 있는데

MediaController.setPrevNextListeners()  listener 순서가 참 헷갈린다.

prevNextListeners 매소드인데 parameter는 next, prev listener 순이다.



Developer 사이트에는 아래처럼 설명하고 있다.


  • The "previous" and "next" buttons are hidden until setPrevNextListeners() has been called
  • The "previous" and "next" buttons are visible but disabled if setPrevNextListeners() was called with null listeners
  • The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false