hyzp_ybqx-Commit163:版本号更新为version: 1.4.33+20220515。升级插件到自定义的my_flutter_superplayer 0.0.3,能够正常播放点位视频

This commit is contained in:
WinUser01
2022-05-13 10:17:30 +08:00
parent 138ece6fc6
commit 1915dbdcd2
25 changed files with 358 additions and 370 deletions
@@ -615,6 +615,15 @@ public class SuperPlayerView extends RelativeLayout {
}
}
public void setTitle(String title) {
this.updateTitle(title);
}
public void setCoverImage(String coverImageUrl) {
this.mWindowPlayer.setBackground(coverImageUrl);
this.mWindowPlayer.showBackground();
}
public void uiHideDanmu() {
mFullScreenPlayer.hideDanmu();
}
@@ -729,7 +738,6 @@ public class SuperPlayerView extends RelativeLayout {
mPlayerViewCallback.onPlayStateChange(SuperPlayerDef.PlayerState.PLAYING);
mWindowPlayer.updatePlayState(SuperPlayerDef.PlayerState.PLAYING);
mFullScreenPlayer.updatePlayState(SuperPlayerDef.PlayerState.PLAYING);
updateTitle(name);
mWindowPlayer.hideBackground();
if (mDanmuView != null && mDanmuView.isPrepared() && mDanmuView.isPaused()) {
mDanmuView.resume();
@@ -93,6 +93,11 @@ public abstract class AbsPlayer extends RelativeLayout implements Player {
@Override
public void setBackground(Bitmap bitmap) {
}
@Override
public void setBackground(String imageUrl) {
}
@Override
@@ -94,6 +94,8 @@ public interface Player {
*/
void setBackground(final Bitmap bitmap);
void setBackground(final String imageUrl);
/**
* 显示背景
*/
@@ -3,7 +3,9 @@ package com.tencent.liteav.demo.superplayer.ui.player;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Build;
import android.util.AttributeSet;
import android.view.GestureDetector;
@@ -23,6 +25,9 @@ import com.tencent.liteav.demo.superplayer.ui.view.VolumeBrightnessProgressLayou
import org.leanflutter.plugins.flutter_superplayer.R;
import java.io.IOException;
import java.net.URL;
/**
* 窗口模式播放控件
*
@@ -443,16 +448,34 @@ public class WindowPlayer extends AbsPlayer implements View.OnClickListener,
});
}
@Override
public void setBackground(String imageUrl) {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
try {
URL url = new URL(imageUrl);
Bitmap bitmap = BitmapFactory.decodeStream(url.openConnection().getInputStream());
mBackgroundBmp = bitmap;
} catch (IOException e) {
e.printStackTrace();
}
post(new Runnable() {
@Override
public void run() {
setBitmap(mBackground, mBackgroundBmp);
}
});
}
});
}
/**
* 设置目标ImageView显示的图片
*/
private void setBitmap(ImageView view, Bitmap bitmap) {
if (view == null || bitmap == null) return;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
view.setBackground(new BitmapDrawable(getContext().getResources(), bitmap));
} else {
view.setBackgroundDrawable(new BitmapDrawable(getContext().getResources(), bitmap));
}
view.setImageBitmap(bitmap);
}
/**
@@ -73,6 +73,10 @@ public class FlutterSuperPlayerView implements PlatformView, MethodCallHandler,
String controlViewType = (String) params.get("controlViewType");
setControlViewType(controlViewType);
if (params.containsKey("coverImageUrl")) {
String coverImageUrl = (String) params.get("coverImageUrl");
setCoverImage(coverImageUrl);
}
}
@Override
@@ -101,6 +105,10 @@ public class FlutterSuperPlayerView implements PlatformView, MethodCallHandler,
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
if (call.method.equals("setControlViewType")) {
setControlViewType(call, result);
} else if (call.method.equals("setTitle")) {
setTitle(call, result);
} else if (call.method.equals("setCoverImage")) {
setCoverImage(call, result);
} else if (call.method.equals("getPlayMode")) {
getPlayMode(call, result);
} else if (call.method.equals("getPlayState")) {
@@ -143,6 +151,19 @@ public class FlutterSuperPlayerView implements PlatformView, MethodCallHandler,
superPlayerView.setControlViewType(controlViewType);
}
void setTitle(@NonNull MethodCall call, @NonNull Result result) {
String title = (String) call.argument("title");
superPlayerView.setTitle(title);
}
void setCoverImage(String coverImageUrl) {
superPlayerView.setCoverImage(coverImageUrl);
}
void setCoverImage(@NonNull MethodCall call, @NonNull Result result) {
String controlViewType = (String) call.argument("coverImageUrl");
superPlayerView.setCoverImage(controlViewType);
}
void getPlayMode(@NonNull MethodCall call, @NonNull Result result) {
int playMode = superPlayerView.getPlayerMode().ordinal();
@@ -271,7 +292,6 @@ public class FlutterSuperPlayerView implements PlatformView, MethodCallHandler,
eventData.put("method", "onClickSmallReturnBtn");
eventSink.success(eventData);
}
@Override
@@ -281,7 +301,6 @@ public class FlutterSuperPlayerView implements PlatformView, MethodCallHandler,
eventData.put("method", "onStartFloatWindowPlay");
eventSink.success(eventData);
}
@Override
@@ -151,5 +151,6 @@
android:id="@+id/superplayer_small_iv_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:visibility="gone" />
</RelativeLayout>