gpt4 book ai didi

video - 在 Android 4.4 及更低版本的 Cordova PhoneGap 应用程序中的 HTML5 视频播放器中播放本地/应用程序内 mp4 文件

转载 作者:行者123 更新时间:2023-11-28 21:41:22 27 4
gpt4 key购买 nike

我使用 Jaeger 25's Html5Video plugin 让视频在 Android 4.0.3 (API 15) 及更高版本上运行.然而,随着 Android 4.4 及其修改后的基于 Chromium 的 WebView 的加入,这个插件不再足够,as mentioned by its awesome developer .

现在,我更愿意在没有任何插件的情况下播放这些视频(这在 iOS 上完美运行......),所以我回去尝试了。我希望这个基于 Chromium 的 webview 对基本的 HTML5 播放更友好,但相反,我得到了与以前完全相同的错误:MediaPlayer(30579): Error (1,-2147483648)

我花了几个小时尝试了几种不同的方法,但都无济于事。我将在下面列出一些我尝试过的事情。拜托,有没有人有任何线索可以指出我正确的方向?我没有想法...

使用 file:/// 的普通文件引用

代码:

    <video id="whoismad" width="75%" height="75%" loop class="videoplayer">
<source src="file:///android_asset/www/res/raw/whoismad.mp4" type="video/mp4">
</video>

结果:

04-24 11:24:30.111: D/HTML5VideoViewProxy(30579): handleMessage - PLAY
04-24 11:24:30.119: D/HTML5VideoInline(30579): HTML5VideoInline created
04-24 11:24:30.127: V/MediaPlayer-JNI(30579): native_setup
04-24 11:24:30.127: V/MediaPlayer(30579): constructor
04-24 11:24:30.142: V/MediaPlayer(30579): setListener
04-24 11:24:30.189: V/MediaPlayer(30579): setVideoSurfaceTexture
04-24 11:24:30.189: V/MediaPlayer-JNI(30579): reset
04-24 11:24:30.189: V/MediaPlayer(30579): reset
04-24 11:24:30.236: V/MediaPlayer(30579): setVideoSurfaceTexture
04-24 11:24:30.236: V/MediaPlayer(30579): prepareAsync
04-24 11:24:30.244: V/MediaPlayer(30579): message received msg=100, ext1=1, ext2=-2147483648

04-24 11:24:30.244: E/MediaPlayer(30579): error (1, -2147483648)

04-24 11:24:30.244: V/MediaPlayer(30579): callback application
04-24 11:24:30.244: V/MediaPlayer(30579): back from callback

04-24 11:24:30.252: E/MediaPlayer(30579): Error (1,-2147483648)

04-24 11:24:30.267: D/HTML5VideoViewProxy(30579): handleMessage - ERROR
04-24 11:24:30.267: D/CordovaWebView(30579): Hidding Custom View
04-24 11:24:30.267: D/HTML5VideoViewProxy(30579): handleMessage - ENDED
04-24 11:24:30.283: D/HTML5VideoViewProxy(30579): handleMessage - SEEK

使用 Phonegap 的文件系统 API 的文件引用

代码:

    <video id="whoismad" width="75%" height="75%" loop class="videoplayer">
<source src="cdvfile://android_asset/www/res/raw/whoismad.mp4" type="video/mp4">
</video>

结果(包含相同的 MediaPlayer (1, -2147483648) 错误):

04-24 11:30:56.705: V/WebViewInputDispatcher(30579): blockWebkitDraw
04-24 11:30:56.705: V/WebViewInputDispatcher(30579): blockWebkitDraw lockedfalse
04-24 11:30:57.033: D/webview(30579): blockWebkitViewMessage= false
04-24 11:30:57.056: D/HTML5VideoViewProxy(30579): handleMessage - PLAY
04-24 11:30:57.064: V/MediaPlayer-JNI(30579): reset
04-24 11:30:57.064: V/MediaPlayer(30579): reset
04-24 11:30:57.064: D/HTML5VideoInline(30579): HTML5VideoInline created
04-24 11:30:57.080: V/MediaPlayer(30579): setVideoSurfaceTexture
04-24 11:30:57.080: V/MediaPlayer-JNI(30579): reset
04-24 11:30:57.080: V/MediaPlayer(30579): reset
04-24 11:30:57.080: I/MediaPlayer(30579): path is null
04-24 11:30:57.095: D/MediaPlayer(30579): setDataSource IOException happend :
04-24 11:30:57.095: D/MediaPlayer(30579): java.io.FileNotFoundException: No content provider: cdvfile://android_asset/www/res/raw/usm.mp4
04-24 11:30:57.095: D/MediaPlayer(30579): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:713)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:617)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:962)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.webkit.HTML5VideoView.prepareDataCommon(HTML5VideoView.java:326)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.webkit.HTML5VideoView.prepareDataAndDisplayMode(HTML5VideoView.java:363)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.webkit.HTML5VideoInline.prepareDataAndDisplayMode(HTML5VideoInline.java:72)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.webkit.HTML5VideoViewProxy$VideoPlayer.play(HTML5VideoViewProxy.java:286)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.webkit.HTML5VideoViewProxy.handleMessage(HTML5VideoViewProxy.java:462)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.os.Looper.loop(Looper.java:175)
04-24 11:30:57.095: D/MediaPlayer(30579): at android.app.ActivityThread.main(ActivityThread.java:5279)
04-24 11:30:57.095: D/MediaPlayer(30579): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 11:30:57.095: D/MediaPlayer(30579): at java.lang.reflect.Method.invoke(Method.java:511)
04-24 11:30:57.095: D/MediaPlayer(30579): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
04-24 11:30:57.095: D/MediaPlayer(30579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
04-24 11:30:57.095: D/MediaPlayer(30579): at dalvik.system.NativeStart.main(Native Method)
04-24 11:30:57.095: D/MediaPlayer(30579): Couldn't open file on client side, trying server side
04-24 11:30:57.095: V/MediaPlayer(30579): setVideoSurfaceTexture
04-24 11:30:57.103: V/MediaPlayer(30579): prepareAsync
04-24 11:30:57.103: V/MediaPlayer(30579): message received msg=100, ext1=1, ext2=-2147483648

04-24 11:30:57.103: E/MediaPlayer(30579): error (1, -2147483648)

04-24 11:30:57.103: V/MediaPlayer(30579): callback application
04-24 11:30:57.103: V/MediaPlayer(30579): back from callback

04-24 11:30:57.111: E/MediaPlayer(30579): Error (1,-2147483648)

04-24 11:30:57.142: D/HTML5VideoViewProxy(30579): handleMessage - ERROR
04-24 11:30:57.142: D/CordovaWebView(30579): Hidding Custom View
04-24 11:30:57.142: D/HTML5VideoViewProxy(30579): handleMessage - ENDED
04-24 11:30:57.158: D/HTML5VideoViewProxy(30579): handleMessage - SEEK

最佳答案

在尝试从应用程序 Assets 中读取视频文件时,Cordova 3.4 目前似乎无法做到这一点。

参见 https://issues.apache.org/jira/browse/CB-6079

如果将文件复制到应用程序 Assets 之外的目录,或者文件远程存储,则可以读取文件。但不再位于应用 Assets 文件夹中。

我有一个类似的问题 - 我的应用程序有一个欢迎屏幕,其中有一段解释应用程序的简短视频 (~300k),我无法通过 APK 本身播放它。

关于video - 在 Android 4.4 及更低版本的 Cordova PhoneGap 应用程序中的 HTML5 视频播放器中播放本地/应用程序内 mp4 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23266043/

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