어떻게 하면 안드로이드에서 비디오 파일을 재생시 오디오만 재생가능하게 할 수 있을까요?

답은 안드로이드 문서에 있습니다.

http://developer.android.com/reference/android/media/MediaPlayer.html

public void setDisplay (SurfaceHolder sh)

Added in API level 1

Sets the SurfaceHolder to use for displaying the video portion of the media. Either a surface holder or surface must be set if a display or video sink is needed. Not calling this method or setSurface(Surface) when playing back a video will result in only the audio track being played. A null surface holder or surface will result in only the audio track being played.

Parameters
shthe SurfaceHolder to use for video display

setDisplay 를 null로 주거나 세팅안하시면됩니다.

그런데 테스트 해보니 재생을 다시 시작해야 되는 이슈가 있구요

로컬 비디오 파일에 대해서는 재생이 오류나는 경우가 있습니다. error -38,0

그래서 일단은 초기 재생시 일반 재생또는 오디오모드 재생으로만 구현했습니다.



Posted by 빈솔B
,