Question

I am trying to integrate a third party product native media player as a Cordova Plugin. This is giving me a lot of problems with getting them to play along. I've written an explanation trying to sum up my knowledge of the problem as best I can. Just thought I'd write this as a short intro first. Any and all hints and answers are greatly appreciated. Because of the limit to size I will post the reference successful run as another post in this thread. I'll also post my question here as well as after the explanation:

Question

My question then is this: Do any of you have any experience that might help on the matter? Anything regarding 3PP native video together with Cordova might be very helpful.


The above picture tries to, in some way, explain the hierarchy of the cordova application. It is of course a simplification and might very well be incorrect as it’s meant to be a representation of my understanding of the system for reference in the text.

What we’re trying to do

Our application sets out to play secured and encrypted video streams through a native video player in a webview. That’s what it does in short form. In more detail: Today we have a basic IPTV web application. However the HTML5 video player can not handle our encrypted streams. Instead we will make it a Cordova/Phonegap plugin where the web application is still the main application but replace the html5 video player with a native 3pp library and display it playing the video (a clear (not encrypted/open) stream. To the user it shall still look and feel the same way but decryption and playback is completely handled by the native cordova plugin. The playback surface view is then placed appropriately for display.

What we’ve done

We have created the cordova project, made it run the web application and created a plugin structure. We have also created the crude VideoPlayer (does not take control input as of yet, only plays a set video) that wraps the third party product library. It manages playback approximately 50% of the time and when it does the surface is displayed and the video is played as we want it to be. However, about half the time during the initial play command to the native library we get an error that stops execution.

What’s happening

(Names relating to 3PP and company removed from log output, as an appendix I will include the log from a successful run for reference below)

05-14 13:55:18.682  17515-17515/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Late-enabling CheckJNI
05-14 13:55:18.682  17515-17515/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Try to disable coredump for pid 17515
05-14 13:55:18.822  17515-17515/se.zxzzxzxz.videoplayer I/CordovaLog﹕ Changing log level to DEBUG(3)
05-14 13:55:18.822  17515-17515/se.zxzzxzxz.videoplayer I/CordovaLog﹕ Found start page location: http:// local network adress:8888/androidindex.html
05-14 13:55:18.822  17515-17515/se.zxzzxzxz.videoplayer D/Whitelist﹕ Unlimited access to network resources
05-14 13:55:18.822  17515-17515/se.zxzzxzxz.videoplayer D/CordovaActivity﹕ CordovaActivity.onCreate()
05-14 13:55:18.842  17515-17515/se.zxzzxzxz.videoplayer I/dalvikvm﹕ Could not find method org.apache.cordova.CordovaWebView.setWebContentsDebuggingEnabled, referenced from method org.apache.cordova.CordovaWebView.setup
05-14 13:55:18.842  17515-17515/se.zxzzxzxz.videoplayer W/dalvikvm﹕ VFY: unable to resolve static method 9717: Lorg/apache/cordova/CordovaWebView;.setWebContentsDebuggingEnabled (Z)V
05-14 13:55:18.842  17515-17515/se.zxzzxzxz.videoplayer D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x00be
05-14 13:55:19.052  17515-17515/se.zxzzxzxz.videoplayer I/webclipboard﹕ clipservice: android.sec.clipboard.ClipboardExManager@2110fd50
05-14 13:55:19.082  17515-17515/se.zxzzxzxz.videoplayer D/CordovaWebView﹕ CordovaWebView is running on device made by: samsung
05-14 13:55:19.092  17515-17515/se.zxzzxzxz.videoplayer D/JsMessageQueue﹕ Set native->JS mode to 2
05-14 13:55:19.092  17515-17515/se.zxzzxzxz.videoplayer D/CordovaActivity﹕ CordovaActivity.init()
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer D/CordovaWebView﹕ >>> loadUrl(http:// local server adress:8888/androidindex.html)
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer D/PluginManager﹕ init()
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer D/CordovaWebView﹕ >>> loadUrlNow()
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer D/WebView﹕ loadUrlImpl: called
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer I/CordovaLog﹕ Changing log level to DEBUG(3)
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer I/CordovaLog﹕ Found start page location: http:// local server adress:8888/androidindex.html
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer D/Whitelist﹕ Unlimited access to network resources
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer D/CordovaActivity﹕ Resuming the App
05-14 13:55:19.142  17515-17515/se.zxzzxzxz.videoplayer D/CordovaActivity﹕ CB-3064: The errorUrl is null
05-14 13:55:19.172  17515-17515/se.zxzzxzxz.videoplayer D/SoftKeyboardDetect﹕ Ignore this event
05-14 13:55:19.192  17515-17544/se.zxzzxzxz.videoplayer V/webkit﹕ BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {2110c420}
05-14 13:55:19.212  17515-17544/se.zxzzxzxz.videoplayer D/webcore﹕ CORE loadUrl: called
05-14 13:55:19.212  17515-17544/se.zxzzxzxz.videoplayer D/webkit﹕ Firewall not null
05-14 13:55:19.212  17515-17544/se.zxzzxzxz.videoplayer D/webkit﹕ euler: isUrlBlocked = false
05-14 13:55:19.232  17515-17515/se.zxzzxzxz.videoplayer D/libEGL﹕ loaded /vendor/lib/egl/libEGL_POWERVR_SGX544_115.so
05-14 13:55:19.272  17515-17515/se.zxzzxzxz.videoplayer D/libEGL﹕ loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX544_115.so
05-14 13:55:19.312  17515-17515/se.zxzzxzxz.videoplayer D/libEGL﹕ loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX544_115.so
05-14 13:55:19.362  17515-17515/se.zxzzxzxz.videoplayer D/OpenGLRenderer﹕ Enabling debug mode 0
05-14 13:55:19.362  17515-17515/se.zxzzxzxz.videoplayer D/WebView﹕ onSizeChanged - w:1280 h:775
05-14 13:55:19.402  17515-17515/se.zxzzxzxz.videoplayer D/CordovaActivity﹕ onMessage(onPageStarted,http:// local server adress:8888/androidindex.html)
05-14 13:55:19.402  17515-17515/se.zxzzxzxz.videoplayer D/SoftKeyboardDetect﹕ Ignore this event
05-14 13:55:19.772  17515-17515/se.zxzzxzxz.videoplayer D/CordovaLog﹕ http:// local server adress:8888/js/bundle.js: Line 9764 : initializing mediaplayer
05-14 13:55:19.772  17515-17515/se.zxzzxzxz.videoplayer I/Web Console﹕ initializing mediaplayer:9764
05-14 13:55:19.862  17515-17515/se.zxzzxzxz.videoplayer D/CordovaLog﹕ http:// local server adress:8888/js/bundle.js: Line 10659 : [object Object]
05-14 13:55:19.862  17515-17515/se.zxzzxzxz.videoplayer I/Web Console﹕ [object Object]:10659
05-14 13:55:19.872  17515-17515/se.zxzzxzxz.videoplayer D/CordovaActivity﹕ onMessage(spinner,stop)
05-14 13:55:19.892  17515-17515/se.zxzzxzxz.videoplayer D/TilesManager﹕ Starting TG #0, 0x637bb530
05-14 13:55:19.892  17515-17515/se.zxzzxzxz.videoplayer D/TilesManager﹕ new EGLContext from framework: 613fcac0
05-14 13:55:19.892  17515-17515/se.zxzzxzxz.videoplayer D/GLWebViewState﹕ Reinit shader
05-14 13:55:19.892  17515-17515/se.zxzzxzxz.videoplayer D/GLWebViewState﹕ Reinit transferQueue
05-14 13:55:19.952  17515-17544/se.zxzzxzxz.videoplayer I/GATE﹕ <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
05-14 13:55:19.952  17515-17515/se.zxzzxzxz.videoplayer D/CordovaWebViewClient﹕ onPageFinished(http:// local server adress:8888/androidindex.html)
05-14 13:55:19.952  17515-17515/se.zxzzxzxz.videoplayer D/CordovaActivity﹕ onMessage(onPageFinished,http:// local server adress:8888/androidindex.html)
05-14 13:55:19.952  17515-17515/se.zxzzxzxz.videoplayer D/CordovaLog﹕ http:// local server adress:8888/js/bundle.js: Line 11295 : Received Event: deviceready
05-14 13:55:19.952  17515-17515/se.zxzzxzxz.videoplayer I/Web Console﹕ Received Event: deviceready:11295
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ Attached
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ se.zxzzxzxz.videoplayer.VideoPlayer@21102cd8
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ onCreate
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ onCreateView
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ com.android.internal.policy.impl.PhoneLayoutInflater@21103958
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer W/ResourceType﹕ No package identifier when getting name for resource number 0x009a2112
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ android.widget.FrameLayout{21133b68 V.E..... ........ 0,0-320,150 #9a2112}
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ onActivityCreated
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ onStart
05-14 13:55:19.972  17515-17515/se.zxzzxzxz.videoplayer I/VideoPlayer﹕ onResume
05-14 13:55:20.032  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ SurfaceView created
05-14 13:55:20.032  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ Initializing Media Player
05-14 13:55:20.032  17515-17515/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ SurfaceView Changed
05-14 13:55:20.972  17515-17522/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Rejecting registerization due to +iget-quick v3, v5, (#20)
05-14 13:55:21.042  17515-17522/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Rejecting registerization due to +iget-quick v3, v5, (#20)
05-14 13:55:22.102  17515-17515/se.zxzzxzxz.videoplayer V/WebViewInputDispatcher﹕ blockWebkitDraw
05-14 13:55:22.102  17515-17515/se.zxzzxzxz.videoplayer V/WebViewInputDispatcher﹕ blockWebkitDraw lockedfalse
**THIS IS WHERE PLAYBACK ACTION IS REQUESTED FROM MEDIA PLAYER**
05-14 13:55:22.282  17515-17613/se.zxzzxzxz.videoplayer V/VideoPlayer﹕ Thread[pool-1-thread-1,5,main]
05-14 13:55:22.292  17515-17613/se.zxzzxzxz.videoplayer I/class com.zxz.playerapi.HLSPlayer﹕ zxzzxzMediaPlayer()
05-14 13:55:22.292  17515-17613/se.zxzzxzxz.videoplayer V/@@@zxz_BasePlayer﹕ getMainLooper()1
05-14 13:55:22.292  17515-17613/se.zxzzxzxz.videoplayer V/@@@zxz_BasePlayer﹕ zxz_BasePlayer Init -
05-14 13:55:22.292  17515-17613/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Trying to load lib /data/app-lib/se.zxzzxzxz.videoplayer-1/libvodl.so 0x422034a0
05-14 13:55:22.292  17515-17613/se.zxzzxzxz.videoplayer D/﹕ calling hookDlopen()!
05-14 13:55:22.292  17515-17613/se.zxzzxzxz.videoplayer D/﹕ calling hookCheckABI2Header()!
05-14 13:55:22.292  17515-17613/se.zxzzxzxz.videoplayer D/﹕ calling houdiniHookInit()!
05-14 13:55:22.342  17515-17515/se.zxzzxzxz.videoplayer D/HTML5VideoViewProxy﹕ handleMessage - SEEK
05-14 13:55:22.352  17515-17613/se.zxzzxzxz.videoplayer D/houdini﹕ [17613] Loading library(version: 3.3.3.43422 RELEASE)... successfully.
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Added shared lib /data/app-lib/se.zxzzxzxz.videoplayer-1/libvodl.so 0x422034a0
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/se.zxzzxzxz.videoplayer-1/libvodl.so 0x422034a0, skipping init
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Trying to load lib /data/app-lib/se.zxzzxzxz.videoplayer-1/libzxz_Eng.so 0x422034a0
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer D/﹕ calling hookDlopen()!
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer D/﹕ calling hookCheckABI2Header()!
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer D/﹕ calling houdiniHookInit()!
05-14 13:55:22.362  17515-17522/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Rejecting registerization due to move v5, v4, (#0)
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Added shared lib /data/app-lib/se.zxzzxzxz.videoplayer-1/libzxz_Eng.so 0x422034a0
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer D/﹕ calling hookJniOnload()!
05-14 13:55:22.362  17515-17613/se.zxzzxzxz.videoplayer V/@@@zxz_StreamSDK.java﹕ getMainLooper()
05-14 13:55:22.372  17515-17522/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Rejecting registerization due to move v5, v4, (#0)
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer V/xzVideoRender.java﹕ Construct!
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer I/@@@xzAudioRender﹕xzAudioRender Construct
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer I/@@@zxz_StreamSDK.java﹕ init spend time is 35
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer V/@@@zxzxzBasePlayer﹕ zxz_BasePlayer Init +, return is 0
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer I/@@@zxz_BasePlayer﹕ /data/app-lib/se.zxzzxzxz.videoplayer-1/libvoDRMJNI.so is not exiest.
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer V/class com.mot.playerapi.HLSPlayer﹕ MediaPlayer is created.
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer E/@@@zxz_BasePlayer﹕ to set parameter to HashMap! id = 3000013
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer E/@@zxz_BasePlayer﹕ to set parameter to HashMap! id = 3000014
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer V/@@@zxz_BasePlayer﹕ setDisplay suface is android.view.SurfaceView{21134db8 V.E..... ......ID 0,515-320,665}
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer V/@@@zxz_StreamSDK.java﹕ setDisplay suface is android.view.SurfaceView$4@21135100
05-14 13:55:22.402  17515-17613/se.zxzzxzxz.videoplayer V/xzVideoRender.java﹕ setSurfaceHolder use RGBA8888!
05-14 14:09:58.282  18934-18975/se.zxzzxzxz.videoplayer E/@@@zxz_BasePlayer﹕ to set parameter to HashMap! id = 3000001
05-14 14:09:58.282  18934-18975/se.zxzzxzxz.videoplayer E/@@@zxz_BasePlayer﹕ to set parameter to HashMap! id = 3000002
05-14 14:09:58.282  18934-18975/se.zxzzxzxz.videoplayer E/@@@zxz_BasePlayer﹕ to set parameter to HashMap! id = 300000c
05-14 14:09:58.282  18934-18975/se.zxzzxzxz.videoplayer V/@@@zxz_BasePlayer﹕ Start ClosedCaption!
05-14 14:09:58.282  18934-18975/se.zxzzxzxz.videoplayer V/@@@zxz_BasePlayer﹕ zxz_BasePlayer Open -
05-14 14:09:58.282  18934-18975/se.zxzzxzxz.videoplayer V/@@@zxz_DataSource.java﹕ Befor loadLibrary, zxz_Source
05-14 14:09:58.282  18934-18975/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Trying to load lib /data/app-lib/se.zxzzxzxz.videoplayer-1/libvodl.so 0x421fc410
05-14 14:09:58.282  18934-18975/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Shared lib '/data/app-lib/se.zxzzxzxz.videoplayer-1/libvodl.so' already loaded in same CL 0x421fc410
05-14 14:09:58.292  18934-18975/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Trying to load lib /data/app-lib/se.zxzzxzxz.videoplayer-1/libzxz_Source.so 0x421fc410
05-14 14:09:58.292  18934-18975/se.zxzzxzxz.videoplayer D/﹕ calling hookDlopen()!
05-14 14:09:58.292  18934-18975/se.zxzzxzxz.videoplayer D/﹕ calling hookCheckABI2Header()!
05-14 14:09:58.292  18934-18975/se.zxzzxzxz.videoplayer D/﹕ calling houdiniHookInit()!
05-14 14:09:58.292  18934-18975/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Added shared lib /data/app-lib/se.zxzzxzxz.videoplayer-1/libzxz_Source.so 0x421fc410
05-14 14:09:58.292  18934-18941/se.zxzzxzxz.videoplayer D/dalvikvm﹕ Rejecting registerization due to and-int/lit8 v4, v6, (#15)
05-14 14:09:58.292  18934-18975/se.zxzzxzxz.videoplayer D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/se.zxzzxzxz.videoplayer-1/libzxz_Source.so 0x421fc410, skipping init
05-14 14:09:58.292  18934-18975/se.zxzzxzxz.videoplayer V/@@@zxz_DataSource.java﹕ after loadLibrary, zxz_Source
05-14 14:09:58.292  18934-18975/se.zxzzxzxz.videoplayer I/@@@zxz_DataSource.java﹕ sourceType is 0, initParamFlag is 0
05-14 14:09:58.312  18934-18950/se.zxzzxzxz.videoplayer A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x79454b7c (code=2), thread 18950 (WebViewCoreThre)
05-14 14:09:58.312  18934-18975/se.zxzzxzxz.videoplayer A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x7ad640d4 (code=2), thread 18975 (pool-1-thread-1)
05-14 14:09:58.322  18934-18934/se.zxzzxzxz.videoplayer A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x7ad6efbc (code=2), thread 18934 (ive.videoplayer) 

There are as one can se lots of warnings and smaller errors in the output. None of them stop execution though and exist wether playback succeeds or not. The execution stops when the various Fatal Signal 11 are received. These are unfortunately not the same every time.

Possible causes and resolutions

In trying to fix the problems I have tried a lot of different things, I will write some of my theories here for reference.

  • At first I thought it was a threading/concurrency issue between WebCore thread and the main thread. I was lead onto this path because of the errors that stated that “android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views” and it took me a while to get the different calls and callbacks to all be executed on the main thread. I managed to make it all run on the main thread however and the problem still persisted thus eliminating the possibility of it being only a threading issue between webcore and ui thread.
  • Turned off and on hardware acceleration, did not work.
  • Tried with different hardware, did not work.
  • Started the Video Player in a new project without cordova in it, this works perfectly, thus not a parameter problem since the same parameters to the player were used at this point.
  • Started the video player so that playback started with a set stream on creation, thus eliminating the call from webcor thread. This worked fine and adds to the confusion for me since I thought I eliminated the possibility of it being a threading problem.
  • Tried with different streams, had no effect.
  • What I am left with is the thought that it has got something to do with the interworkings between the precompiled third party native video player library and cordova on a low level or in building of the project.

Question

My question then is this: Do any of you have any experience that might help on the matter? Anything regarding 3PP native video together with Cordova might be very helpful.

PS: This is my first stackoverflow question, sorry for the shabby formatting.

Was it helpful?

Solution

Ok, we have understood now what the problem was and now that I have time I thought I should share it.

As evident from the log (05-14 14:09:58.292 18934-18975/se.zxzzxzxz.videoplayer D/﹕ calling houdiniHookInit()!) houdini is started. Now what is Houdini you might ask.

Houdini helps emulate arm behaviour on an x86 core so that arm libraries may be used on the device(How does native android code written for ARM run on x86?)

So, the answer to our question was that we were using the arm-compiled library but our device had an x86 core. Something broke in the emulation and the segfaults were the result. We have switched devices and everything is working fine now.

Thank you though for viewing this post and I hope it might help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top