gpt4 book ai didi

android - 从 Android 上的 Axis 相机获取 rtsp 流

转载 作者:太空宇宙 更新时间:2023-11-03 11:22:46 24 4
gpt4 key购买 nike

我正在尝试将来自 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

有什么提示吗?谢谢

最佳答案

video.start(); 之前调用 video.requestFocus();。我猜它会让您的代码运行。

关于android - 从 Android 上的 Axis 相机获取 rtsp 流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4956813/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com