Skip to content

Commit

Permalink
fix getDefaultVideoPoster() #19
Browse files Browse the repository at this point in the history
  • Loading branch information
youlookwhat committed Aug 3, 2020
1 parent 700a794 commit 7677d27
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ByWebView/src/main/java/me/jingbin/web/ByWebChromeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.text.TextUtils;
import android.util.Log;
Expand Down Expand Up @@ -251,4 +254,14 @@ public void onPermissionRequest(PermissionRequest request) {
ByFullscreenHolder getVideoFullView() {
return videoFullView;
}

@Nullable
@Override
public Bitmap getDefaultVideoPoster() {
if (super.getDefaultVideoPoster() == null) {
return BitmapFactory.decodeResource(mByWebView.getWebView().getResources(), R.drawable.by_icon_video);
} else {
return super.getDefaultVideoPoster();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.view.View;

import com.example.jingbin.webviewstudy.R;
import com.tencent.smtt.sdk.ValueCallback;
import com.tencent.smtt.export.external.interfaces.IX5WebChromeClient;

Expand Down Expand Up @@ -175,4 +179,14 @@ public void mUploadMessageForAndroid5(Intent intent, int resultCode) {
}
mUploadMessageForAndroid5 = null;
}

@Nullable
@Override
public Bitmap getDefaultVideoPoster() {
if (super.getDefaultVideoPoster() == null) {
return BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.by_icon_video);
} else {
return super.getDefaultVideoPoster();
}
}
}

0 comments on commit 7677d27

Please sign in to comment.