我的Live vlc视频流可在模拟器上运行,但不能在真实设备上运行

时间:2018-12-14 18:11:23

标签: android vlc

嗨,我是Android Studio的新手,我遇到了一个问题,我试图在手机上播放VLC直播,但几秒钟后我收到一条消息,提示“无法播放视频”。奇怪的是,视频实时流将在android studio中的模拟器上播放。我将在下面添加我的代码。我还向清单添加了Internet权限。如果有人可以帮助,那就太好了,在此先感谢

 //XML Code
 <LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 tools:context="com.pkinsellaweb.BabyMate.VideoScreen"
 >

<VideoView
android:id="@+id/videoView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>

//Java Code
public class VideoScreen extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


        setContentView(R.layout.activity_video_screen);

    VideoView video = (VideoView) findViewById(R.id.videoView);


    String vidAdd = "http://192.168.43.66:8160";
    Uri videoPath = Uri.parse(vidAdd);
    video.setVideoURI(videoPath);

    MediaController mediaController = new
            MediaController(this);
    mediaController.setAnchorView(video);
    video.setMediaController(mediaController);
    video.start();
}
}

0 个答案:

没有答案