Webview: Default Plugin State

What’s the default plugin state for a Corona SDK webView, and is it possible to change?

I’m talking about this webkit method:

public synchronized void setPluginState (WebSettings.PluginState state)

Tells the WebView to enable, disable, or have plugins on demand. On demand mode means that if a plugin exists that can handle the embedded content, a placeholder icon will be shown instead of the plugin. When the placeholder is clicked, the plugin will be enabled. 

Enum Values
WebSettings.PluginState  OFF  
WebSettings.PluginState  ON  
WebSettings.PluginState  ON_DEMAND

The PluginState is set to ON in Corona.  It is not changeable.

That’s what I suspected. I would appreciate if you could add an option to allow the developer to set this.

I have an app were I need to display YouTube videos and I’m getting inconsistent behaviour on Android.

iOS is fine as is Android 4.1+ (as Flash is not available on these devices), which forces the HTML5 version of the video to be played.

Flash is dead on all versions of Android, however it continues to kick on devices that have a built-in version. 

I want the HTML5 versions of the YouTube videos to be displayed on all devices. What I’m seeing on pre 4.1 devices is poor performance and erratic behaviour when the Flash versions are played, especially if the YouTube user has activated advertisements. 

On devices with poor performance with the Corona SDK webView, I’ve done some testing by loading the same html-file I’m using with the webView in the stock browser instead, making sure that plugins are off to force the HTML5 version to play. When plugins are off, the HTML5 video plays perfectly on these devices.

I was hoping that the Corona webView would honour the browser’s plugin setting, however that doesn’t seem to be the case. For me, the only way to get consistent behaviour across Android devices is to disable Flash content from being played in a webView. And the only way to do that would be to set the webView plugin state to OFF.

I would really appreciate it  :wub: if you could add an option to allow the developer to set this.  

I was able to force YouTube HTML5 content by adding “&html5=1” to the source string of the iframe.

But it only works on Android 4.1+.

On Android 2.3 I get the poster image with the Play button, but when I tap the Play button I just get a blank black frame with no video.

See logcat below.

What strikes me first is the misspelled “FALSE” on line 4…

I/InputReader(  131): dispatchTouch::touch event’s action is 1
I/InputDispatcher(  131): Delivering touch to current input target: action: 1
I/InputDispatcher(  131): Delivering touch to current input target: action: 1
V/webview ( 8704):  singleCursorHandlerTouchEvent -getEditableSupport  FASLE
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not

The PluginState is set to ON in Corona.  It is not changeable.

That’s what I suspected. I would appreciate if you could add an option to allow the developer to set this.

I have an app were I need to display YouTube videos and I’m getting inconsistent behaviour on Android.

iOS is fine as is Android 4.1+ (as Flash is not available on these devices), which forces the HTML5 version of the video to be played.

Flash is dead on all versions of Android, however it continues to kick on devices that have a built-in version. 

I want the HTML5 versions of the YouTube videos to be displayed on all devices. What I’m seeing on pre 4.1 devices is poor performance and erratic behaviour when the Flash versions are played, especially if the YouTube user has activated advertisements. 

On devices with poor performance with the Corona SDK webView, I’ve done some testing by loading the same html-file I’m using with the webView in the stock browser instead, making sure that plugins are off to force the HTML5 version to play. When plugins are off, the HTML5 video plays perfectly on these devices.

I was hoping that the Corona webView would honour the browser’s plugin setting, however that doesn’t seem to be the case. For me, the only way to get consistent behaviour across Android devices is to disable Flash content from being played in a webView. And the only way to do that would be to set the webView plugin state to OFF.

I would really appreciate it  :wub: if you could add an option to allow the developer to set this.  

I was able to force YouTube HTML5 content by adding “&html5=1” to the source string of the iframe.

But it only works on Android 4.1+.

On Android 2.3 I get the poster image with the Play button, but when I tap the Play button I just get a blank black frame with no video.

See logcat below.

What strikes me first is the misspelled “FALSE” on line 4…

I/InputReader(  131): dispatchTouch::touch event’s action is 1
I/InputDispatcher(  131): Delivering touch to current input target: action: 1
I/InputDispatcher(  131): Delivering touch to current input target: action: 1
V/webview ( 8704):  singleCursorHandlerTouchEvent -getEditableSupport  FASLE
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not
D/CONTEXT ( 8704): m_mainFrame->editor()->hasComposition not