Я использовал videoView для воспроизведения файла mp4 из Интернета, но он не может воспроизводить это видео все время.Это мой код:
Uri uri = Uri.parse("http://vfx.mtime.cn/Video/2019/02/08/mp4/190208204943376259.mp4");
videoView.setVideoURI(uri);
videoView.setOnPreparedListener(createOnPreparedListener());
private MediaPlayer.OnPreparedListener createOnPreparedListener(){
return new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
}
};
}
Он может хорошо работать в моем эмуляторе, но не на моем устройстве Android.И мой targetSdkVersion и compileSdkVersion - это 28, мой API-интерфейс устройства Android - это Android-28, мой API-интерфейс эмулятора - 23
, а logcat выглядит следующим образом:
2019-03-15 09:11:49.867 26152-26152/com.uitest W/com.uitest: JIT profile information will not be recorded: profile file does not exits.
2019-03-15 09:11:49.873 26152-26152/com.uitest I/chatty: uid=10049(com.uitest) identical 10 lines
2019-03-15 09:11:49.873 26152-26152/com.uitest W/com.uitest: JIT profile information will not be recorded: profile file does not exits.
2019-03-15 09:11:49.915 26152-26152/com.uitest I/InstantRun: starting instant run server: is main process
2019-03-15 09:11:50.088 26152-26152/com.uitest D/OpenGLRenderer: Skia GL Pipeline
2019-03-15 09:11:50.168 26152-26170/com.uitest I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2019-03-15 09:11:50.168 26152-26170/com.uitest I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2019-03-15 09:11:50.169 26152-26170/com.uitest I/OpenGLRenderer: Initialized EGL, version 1.4
2019-03-15 09:11:50.169 26152-26170/com.uitest D/OpenGLRenderer: Swap behavior 2
2019-03-15 09:11:50.184 26152-26170/com.uitest D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2019-03-15 09:11:54.270 26152-26152/com.uitest W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@2732a9
2019-03-15 09:11:54.477 26152-26170/com.uitest D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2019-03-15 09:11:54.521 26152-26152/com.uitest W/MediaPlayer: Couldn't open http://vfx.mtime.cn/Video/2019/02/08/mp4/190208204943376259.mp4: java.io.FileNotFoundException: No content provider: http://vfx.mtime.cn/Video/2019/02/08/mp4/190208204943376259.mp4
2019-03-15 09:11:54.521 26152-26152/com.uitest V/MediaHTTPService: MediaHTTPService(android.media.MediaHTTPService@f158d8c): Cookies: null
2019-03-15 09:11:54.578 26152-26165/com.uitest V/MediaHTTPService: makeHTTPConnection: CookieManager created: java.net.CookieManager@b0e0224
2019-03-15 09:11:54.580 26152-26165/com.uitest V/MediaHTTPService: makeHTTPConnection(android.media.MediaHTTPService@f158d8c): cookieHandler: java.net.CookieManager@b0e0224 Cookies: null
2019-03-15 09:11:54.594 26152-26165/com.uitest D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2019-03-15 09:11:55.136 26152-26170/com.uitest W/libEGL: EGLNativeWindowType 0x95077008 disconnect failed
2019-03-15 09:12:24.841 26152-26166/com.uitest E/MediaPlayerNative: error (1, -2147483648)
2019-03-15 09:12:24.842 26152-26152/com.uitest E/MediaPlayer: Error (1,-2147483648)
2019-03-15 09:12:24.842 26152-26152/com.uitest D/VideoView: Error: 1,-2147483648
2019-03-15 09:12:25.037 26152-26170/com.uitest D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000