4

Axis カメラからの rtsp ストリームを mediaplayer オブジェクトに表示しようとしています。コードは次のとおりです。

public class Rtsp extends Activity {

String PATH_TO_STREAM = "rtsp://192.168.131.21/mpeg4/1/media.3gp";

private VideoView video;
private MediaController ctlr;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    video=(VideoView)findViewById(R.id.video);
    ctlr=new MediaController(this);
    ctlr.setAnchorView(video);

    Uri videoUri = Uri.parse(PATH_TO_STREAM);
    video.setMediaController(ctlr);
    video.setVideoURI(videoUri);
    video.start();
}}

VLC では正しくストリーミングできますが、Android では次のエラーが発生します。

02-10 11:58:07.071: ERROR/PlayerDriver(31): Command PLAYER_PREPARE completed with an error or info PVMFErrResourceConfiguration
02-10 11:58:07.101: ERROR/MediaPlayer(432): error (1, -16)
02-10 11:58:07.101: ERROR/MediaPlayer(432): Error (1,-16)
02-10 11:58:07.101: DEBUG/VideoView(432): Error: 1,-16
02-10 11:58:07.121: WARN/PlayerDriver(31): PVMFInfoErrorHandlingComplete
02-10 11:58:07.711: WARN/InputManagerService(60): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@43bfce30 (uid=10007 pid=106)
02-10 11:58:12.902: DEBUG/dalvikvm(106): GC freed 2635 objects / 150552 bytes in 314ms

ヒントはありますか?ありがとう

4

1 に答える 1

0

video.requestFocus();前に電話してくださいvideo.start();。私はそれがあなたのコードを実行させると思います。

于 2012-02-17T12:21:25.200 に答える