Playing local / in mp4 files in applications in the HTML5 video player in the Cordova PhoneGap application on Android 4.4 and below

I got a video to work on Android 4.0.3 (API 15) and using the Jaeger 25 Html5Video plugin . However, with the addition of Android 4.4 and its revised Chromium-based web browser, this plugin is no longer enough, as mentioned by its wonderful developer .

Now I would rather play these videos without any plugins (which works great on iOS ...), so I went back to that. It was hoped that this web presentation based on Chromium is more friendly with a basic HTML5 playback, but instead I'll just get the same error as before: MediaPlayer(30579): Error (1,-2147483648).

I spent several hours on several different approaches, all to no avail. I will give a few things that I have tried below. Please, does anyone have any clues to point me in the right direction? I have no ideas ...

Normal file link using file: ///

the code:

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

Results in:

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

File Link Using Phonegap File System API

The code:

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

Results in (contains the same MediaPlayer error (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
+4
source share
1 answer

It seems that this is currently not possible in the case of Cordova 3.4 when trying to read a video file from application assets.

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

, . .

. , (~ 300k), APK.

+4

Source: https://habr.com/ru/post/1537859/


All Articles