作者:陛下今晚由臣来侍寝吧值 | 来源:互联网 | 2023-02-09 16:11
我想将实时视频流式传输到我的Android应用程序.我正在使用动作服务从我的覆盆子pi的相机(小型USB连接相机)流式传输实时视频.我有端口8082的设置,所以我可以从任何浏览器成功输入(exampled IP)" http://74.220.185.125:8082 "并看到我的视频流.但是,当我在使用videoView的应用程序的代码中使用它时,每次都会抛出异常.
主要活动:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Starting video
piVideo = (VideoView) findViewById(R.id.piVidView);
try{
piVideo.setVideoURI(Uri.parse("http://74.220.185.125:8082/"));
} catch (Exception e){
Log.e("Error found here->", e.getMessage());
e.printStackTrace();
}
piVideo.requestFocus();
piVideo.start();
piVideo.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
piVideo.start();
}
});
}
每一次,我都会得到同样的错误:
03-08 12:46:49.258 1412-1412/com.me.blah.app D/MediaPlayer: setDataSource IOException | SecurityException happend :
java.io.FileNotFoundException: No content provider: http://74.220.185.125:8082/
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1141)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:991)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:914)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1121)
at android.widget.VideoView.openVideo(VideoView.java:371)
at android.widget.VideoView.access$2100(VideoView.java:71)
at android.widget.VideoView$7.surfaceCreated(VideoView.java:652)
at android.view.SurfaceView.updateWindow(SurfaceView.java:712)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:209)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1014)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2510)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1437)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7397)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920)
at android.view.Choreographer.doCallbacks(Choreographer.java:695)
at android.view.Choreographer.doFrame(Choreographer.java:631)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
我的清单文件中启用了INTERNET:
"uses-permission android:name="android.permission.INTERNET"
我已经尝试过rstp://和http://但两者仍然会被抛出相同的异常.任何人都可以看到我的异常可能来自哪里?