Video streaming 视频流在几秒钟后冻结,但声音工作正常

Video streaming 视频流在几秒钟后冻结,但声音工作正常,video-streaming,android-mediaplayer,android-videoview,freeze,android-mediacodec,Video Streaming,Android Mediaplayer,Android Videoview,Freeze,Android Mediacodec,我正在编写一个应用程序,使用VideoView从互联网播放m3u8流媒体。流媒体看起来像是在播放,但几秒钟后就停止了,尽管如此,音频仍然可以正常工作 如果我用VLC视频播放器打开流媒体,它可以正常工作,所以这不是因为流媒体 编解码器为:(数据取自VLC) 活动主目录 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"

我正在编写一个应用程序,使用VideoView从互联网播放m3u8流媒体。流媒体看起来像是在播放,但几秒钟后就停止了,尽管如此,音频仍然可以正常工作

如果我用VLC视频播放器打开流媒体,它可以正常工作,所以这不是因为流媒体

编解码器为:(数据取自VLC)

活动主目录

 <androidx.constraintlayout.widget.ConstraintLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent" tools:context=".MainActivity">

 <VideoView
     android:id="@+id/myVideoView"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_marginTop="0dp"
     android:layout_marginBottom="0dp"
     app:layout_constraintBottom_toBottomOf="parent"
     app:layout_constraintTop_toTopOf="parent"
     />


 </androidx.constraintlayout.widget.ConstraintLayout>
谁能帮我一下吗?这很奇怪。 提前谢谢

PS:如果我用Códec:H264-MPEG-4 AVC(第10部分)(avc1)更改另一个m3u8的流媒体网址,它不会启动视频(给出错误),如果我使用rtsp流媒体地址,它工作正常

    package com.name.name;

    import android.content.pm.ActivityInfo;
    import android.net.Uri;
    import android.os.Bundle;
    import android.view.View;
    import android.view.Window;

    import android.widget.MediaController;
    import android.widget.Toast;
    import android.widget.VideoView;
    import android.app.Activity;

    public class MainActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        setContentView(R.layout.activity_main);

        Toast.makeText(this, "Cargando vídeo", Toast.LENGTH_LONG).show();
        VideoView vw = (VideoView) findViewById(R.id.myVideoView);

        vw.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
        vw.setVisibility(View.VISIBLE);

        vw.setVideoPath("streamingwebaddress.m3u8");
        vw.start();


    }
}
 <androidx.constraintlayout.widget.ConstraintLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent" tools:context=".MainActivity">

 <VideoView
     android:id="@+id/myVideoView"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_marginTop="0dp"
     android:layout_marginBottom="0dp"
     app:layout_constraintBottom_toBottomOf="parent"
     app:layout_constraintTop_toTopOf="parent"
     />


 </androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.name.name"
    android:installLocation="auto">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.name.name"
        minSdkVersion 22
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

    dependencies {
        implementation fileTree(dir: "libs", include: ["*.jar"])
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        testImplementation 'junit:junit:4.13'
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}