从 Android 上的 Axis 摄像头获取 rtsp 流

发布于 2024-10-16 22:41:34 字数 1348 浏览 1 评论 0原文

我正在尝试将来自 Axis 摄像头的 rtsp 流显示到媒体播放器对象中,代码如下:

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

有任何提示吗?谢谢

I'm trying to show rtsp stream from an Axis camera into a mediaplayer object, here the code:

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();
}}

I can correctly stream with the VLC but I get this error with 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

Any hint? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深者入戏 2024-10-23 22:41:35

video.start(); 之前调用 video.requestFocus();。我想这会让你的代码运行。

Call video.requestFocus(); before video.start();. I guess it will make your code run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文