|
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.DialogInterface; |
23 | 23 | import android.content.res.Resources; |
| 24 | +import android.graphics.Bitmap; |
24 | 25 | import android.media.AudioManager; |
25 | 26 | import android.media.MediaPlayer; |
26 | 27 | import android.net.Uri; |
27 | 28 | import android.os.Build; |
28 | 29 | import android.support.annotation.NonNull; |
| 30 | +import android.support.annotation.Nullable; |
29 | 31 | import android.support.v7.app.AlertDialog; |
30 | 32 | import android.text.TextUtils; |
31 | 33 | import android.util.AttributeSet; |
32 | 34 | import android.util.Log; |
33 | 35 | import android.view.Gravity; |
34 | 36 | import android.view.KeyEvent; |
35 | 37 | import android.view.MotionEvent; |
| 38 | +import android.view.TextureView; |
36 | 39 | import android.view.View; |
37 | 40 | import android.widget.FrameLayout; |
38 | 41 | import android.widget.MediaController; |
@@ -1037,7 +1040,7 @@ public IMediaPlayer createPlayer(int playerType) { |
1037 | 1040 | IjkMediaPlayer ijkMediaPlayer = null; |
1038 | 1041 | if (mUri != null) { |
1039 | 1042 | ijkMediaPlayer = new IjkMediaPlayer(); |
1040 | | - ijkMediaPlayer.native_setLogLevel(IjkMediaPlayer.IJK_LOG_DEBUG); |
| 1043 | + ijkMediaPlayer.native_setLogLevel(mSettings.getLogLevel()); |
1041 | 1044 |
|
1042 | 1045 | if (mSettings.getUsingMediaCodec()) { |
1043 | 1046 | ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1); |
@@ -1277,4 +1280,18 @@ private void setupFrameAvailableListener() { |
1277 | 1280 | Log.w(TAG_TG, "mMediaPlayer isn't IjkMediaPlayer, nonsupport setOnFrameAvailableListener"); |
1278 | 1281 | } |
1279 | 1282 | } |
| 1283 | + |
| 1284 | + @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) |
| 1285 | + public void snapshot(OnSnapshotResultCallback callback) { |
| 1286 | + if (mRenderView != null && mRenderView.getView() instanceof TextureView) { |
| 1287 | + TextureView view = (TextureView) mRenderView.getView(); |
| 1288 | + callback.onSnapshotResult(view.getBitmap()); |
| 1289 | + } else { |
| 1290 | + callback.onSnapshotResult(null); |
| 1291 | + } |
| 1292 | + } |
| 1293 | + |
| 1294 | + public interface OnSnapshotResultCallback { |
| 1295 | + void onSnapshotResult(@Nullable Bitmap bitmap); |
| 1296 | + } |
1280 | 1297 | } |
0 commit comments