android


Videos not playing in fullscreen mode


I am getting a NPE when trying to play embeded video in webview in FULLSCREEN. It is working fine with 3.0 honeycomb but not with ICS 4.0+. Any idea how this can be resolved?
java.lang.NullPointerException
at android.webkit.PluginFullScreenHolder.show(PluginFullScreenHolder.java:85)
at android.webkit.WebView$PrivateHandler.handleMessage(WebView.java:8849)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Any suggestion will be really appreciated. Thanks
Try adding a WebChromeClient to your WebView:
webView.setWebChromeClient(new WebChromeClient());
That should stop the crash (I think it's similar to what we were experiencing) but I don't think it will get the video to play in full screen.
To do that I think you will have to do something like this: Android ICS 4.0 Placing Flash WebView into full screen calls hideAll Method? Which I am still trying to figure out.
The problem is a bug in android OS. You need a work around to resolve this problem.
I was facing the same problem. The following work around worked for me.Hope this will help some people:
Create the FullscreenableChromeClient and
add this line:
WebView.setWebChromeClient( new FullscreenableChromeClient(this));
public class FullscreenableChromeClient extends WebChromeClient {
protected Activity mActivity = null;
private View mCustomView;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
private int mOriginalOrientation;
private FrameLayout mContentView;
private FrameLayout mFullscreenContainer;
private static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
public FullscreenableChromeClient(Activity activity) {
this.mActivity = activity;
}
#Override
public void onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (mCustomView != null) {
callback.onCustomViewHidden();
return;
}
mOriginalOrientation = mActivity.getRequestedOrientation();
FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
mFullscreenContainer = new FullscreenHolder(mActivity);
mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
mCustomView = view;
setFullscreen(true);
mCustomViewCallback = callback;
mActivity.setRequestedOrientation(requestedOrientation);
}
super.onShowCustomView(view, requestedOrientation, callback);
}
#Override
public void onHideCustomView() {
if (mCustomView == null) {
return;
}
setFullscreen(false);
FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
decor.removeView(mFullscreenContainer);
mFullscreenContainer = null;
mCustomView = null;
mCustomViewCallback.onCustomViewHidden();
mActivity.setRequestedOrientation(mOriginalOrientation);
}
private void setFullscreen(boolean enabled) {
Window win = mActivity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
if (enabled) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
if (mCustomView != null) {
mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
} else {
mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
win.setAttributes(winParams);
}
private static class FullscreenHolder extends FrameLayout {
public FullscreenHolder(Context ctx) {
super(ctx);
setBackgroundColor(ctx.getResources().getColor(android.R.color.black));
}
#Override
public boolean onTouchEvent(MotionEvent evt) {
return true;
}
}
}

Related Links

AudioManager.startBluetoothSco() crashes on Android Lollipop
Hide keyboard on android application
Icon app with Cordova. Documentation is wrong?
R cannot be resolved/ No resouce found that matches given name
Adding ViewPager in a Custom Dialog. Can't get the adapter to work
difference between mAdded & mActive in source code of support.FragmentManager
Google App Engine Custom SSL & Android SNI + VIP?
Android - ImageView flickering by changing the Image (Bitmap) on it
Android: Picasso load image failed . how to show error message
Is it possible to integrate a gradle Library project to an android Project
How to integrate Navigation drawer with out using support library
Unable to apply function on Listview item button click and inset data in database
I used this code below to simple display multiple images from links but application closed
Disable popup in select box in android device
How to run the Wear app with handled app with out any signing? I mean developer debug mode
Default Android host files block Google Analytics?

Categories

HOME
cygwin
phpword
api
paraview
zend-framework
apache-spark-mllib
oracle-apex-5
socket.io
alsa
crystal-reports-2013
joomla3.0
sendgrid-api-v3
arangodb
pega
siddhi
windows-ce
project-intu
mautic
supervisor
renjin
zerobrane
enterprise-architect
android-intent
symbol
http-post
keytool
foreign-keys
lilypond
ember-cli
r-mice
angular-routing
pimcore
qliksense
tosca
beta
definitelytyped
handler
spotipy
sinch
jaws
winpe
ntp
eviews
sql-delete
xajax
hivemq
alphabetical
dm-script
sessionstorage
metawidget
azure-arm
preloader
linqpad
glm-math
servermanager
dynamic-linq
xbmc
netbeans6.8
rserve
convex-optimization
trojan
payload
monkey
cpu-cache
gameplay-kit
pocketsphinx-android
async.js
uicolor
wso2developerstudio
mapinfo
hclust
nservicebus5
pushbots
invoke-sqlcmd
kendo-upload
exim4
concept-insights
boomerang
wiredep
visual-sourcesafe-2005
uncompress
sha512
git-ftp
broadband
exceldatareader
ssis-data-flow
insight.database
ss7
kissfft
ora-00904
reflector
live555
cfcache
away3d
asdf
workitem
nebula
abstract-data-type
wp7test
server-administration
preload
redis-py
mkv
qtconcurrent
cakephp-1.2
faye
subgraph
failing-tests
fitbounds
cac
undefined-index
message-passing
web-garden
zen
burndowncharts
web-application-project
dojo-dnd
fdf
int64
unmanagedresources

Resources

Encrypt Message