마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

rstp경로를 지정했는데 setDataSource로 받아들이지를 못하네요.

0 추천
코드는 아래와 같은데요. rtsp://192.168.60.195/cho/s.mp4가 경로고 와우자서버로 돌렸습니다. 직접 영상을 틀었을 땐 재생이 잘 되었는데요. 비디오플레이어를 아래와같이 만들어서 path로 넣으려니까 되질 않습니다. logcat에

05-06 11:24:00.401: E/MediaPlayer(25490): Unable to to create media player
05-06 11:24:00.401: V/CUSTOM_VIDEO_PLAYER(25490): IOExceptionsetDataSource failed.: status=0x80000000
와 같이 뜨는데 문제가 뭔지 모르겠어요. 읽어들이지를 못하는거 같은데 어떻게 해야되나요ㅜㅠ..답변부탁드립니다.

public class MainActivity extends Activity {
 
 Display currentDisplay;
 
 SurfaceView surfaceview;
 SurfaceHolder surfaceholder;
 View mainView;
 TextView statusview;
 
 MediaPlayer mediaplayer;
 MediaController controller;
 int videowidth =0;
 int videoheight = 0;
 
 boolean readyToPlay;
 
 public final static String LOGTAG = "CUSTOM_VIDEO_PLAYER";

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  
  
  surfaceview = (SurfaceView)findViewById(R.id.surfaceView1);
  surfaceholder=surfaceview.getHolder();
  surfaceholder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  
  mainView = this.findViewById(R.id.MainView);
  statusview = (TextView)findViewById(R.id.statusview);
  mediaplayer =  new MediaPlayer();
  
  String filepath = "rtsp://192.168.60.195/cho/s.mp4";
  
  
   try {
    mediaplayer.setDataSource(filepath);
   } catch (IllegalArgumentException e) {
    // TODO Auto-generated catch block
    Log.v(LOGTAG, "IllegalArgumentException" + e.getMessage());
    finish();
   } catch (IllegalStateException e) {
    // TODO Auto-generated catch block
    Log.v(LOGTAG, "IllegalStateException" + e.getMessage());
    finish();
    
   } catch (IOException e) {
    // TODO Auto-generated catch block
    Log.v(LOGTAG, "IOException" + e.getMessage());
    finish();
   }
   
   statusview.setText("MediaPlayer DataSource Set");
   currentDisplay = getWindowManager().getDefaultDisplay();
   controller =  new MediaController(this);
wonie86 (300 포인트) 님이 2013년 5월 6일 질문

1개의 답변

0 추천
Uri videoUri = Uri.parse("비디오URL");
mediaPlayer.setDataSource(context, videoUri);

이렇게 줘보세요.

얼룩돼지 (15,720 포인트) 님이 2013년 5월 6일 답변
Uri uriparse = Uri.parse("rtsp://192.168.60.195/cho/s.mp4");
mediaplayer.setDataSource(getApplicationContext(), uriparse);

위와 같이 코드를 다시 짰는데

logcat에
05-06 12:14:38.481: I/MediaPlayer(26268): path is null
05-06 12:14:38.481: D/MediaPlayer(26268): Couldn't open file on client side, trying server side
05-06 12:14:38.481: E/MediaPlayer(26268): Unable to to create media player
05-06 12:14:38.491: V/CUSTOM_VIDEO_PLAYER(26268): IOExceptionsetDataSource failed.: status=0x80000000
또 이렇게 뜨네요. 경로는 맞는게 이걸 갤텝에서 인터넷에 직접주소를 쳐서 기본플레이어에서 동작하는걸 확인했거든요ㅜㅠ....뭐가 문제일까요;;;;;
클라이언트 사이드에서 파일을 열수없다는데요.
mediaPlayer쪽 설정이 잘못되어 있는거같네요.
...