Merge remote-tracking branch 'Gitea/master' into iOS

# Conflicts:
#	lib/my_flutter_superplayer/example/ios/Podfile.lock
#	lib/widget/my_superplayer.dart
#	pubspec.lock
#	pubspec.yaml
This commit is contained in:
2022-05-14 15:37:02 +08:00
115 changed files with 4552 additions and 1427 deletions
+7 -2
View File
@@ -1,7 +1,12 @@
## 0.0.3
- 增加 `setTitle` 方法,用于设置视频标题
- 增加 `setCoverImage` 方法,用于设置视频封面
## 0.0.2
* Add `setLoop` support
- Add `setLoop` support
## 0.0.1
* Initial release.
- Initial release.
+1 -1
View File
@@ -26,7 +26,7 @@
```yaml
dependencies:
flutter_superplayer: ^0.0.1
flutter_superplayer: ^0.0.3
```
或
@@ -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>
@@ -38,9 +38,6 @@ android {
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
// ndk {
// abiFilters "armeabi-v7a"
// }
}
buildTypes {
@@ -22,6 +22,11 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
@@ -1,220 +1,102 @@
///App.Car_Dwinfo.GetList 获取分页列表数据
Map mapDwinfo = {
Map mapDwinfoXwx = {
"ret": 200,
"data": {
"items": [
{
"id": 1,
"dwip": "172.16.3.1",
"dwmc": "锦绣花园",
"dwbh": 1,
"dwinfo": "振兴大道锦绣花园附近",
"dwzb": "104.607091|28.807061",
"dwms": "振兴大道锦绣花园附近,识别孜岩、红坝路入城排放黑烟车辆",
"id": 21,
"dwip": "172.16.3.21",
"dwmc": "大礼村",
"dwbh": 21,
"dwinfo": "兴文大礼村附近",
"dwzb": "105.270298|28.285956",
"dwms": "大礼村附近,抓拍自泸州叙永县方向入城黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320001012_34020000001320001012",
"video13": "/rtp/gb_play_34020000001320001014_34020000001320001014",
"video14": "/rtp/gb_play_34020000001320001013_34020000001320001013",
"video15": "/rtp/gb_play_34020000001320001015_34020000001320001015",
"video16": "/rtp/gb_play_34020000001320001016_34020000001320001016",
"play_urlhead": "rtmp://125.64.218.67:9901"
},
{
"id": 2,
"dwip": "172.16.3.2",
"dwmc": "石马溪桥",
"dwbh": 2,
"dwinfo": "宜飞路石马溪大桥附近",
"dwzb": "104.589904|28.787078",
"dwms": "宜飞路石马溪大桥附近,识别屏山、菜坝入城排放黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320002012_34020000001320002012",
"video13": "/rtp/gb_play_34020000001320002013_34020000001320002013",
"video12": "/rtp/gb_play_34020000001320021012_34020000001320021012",
"video13": "/rtp/gb_play_34020000001320021013_34020000001320021013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320002016_34020000001320002016",
"play_urlhead": "rtmp://125.64.218.67:9901"
"video16": "/rtp/gb_play_34020000001320021016_34020000001320021016",
"play_urlhead": "rtmp://125.64.218.67:9901",
"qxdm": "511528",
"qxmc": "兴文县"
},
{
"id": 3,
"dwip": "172.16.3.3",
"dwmc": "森林小区",
"dwbh": 3,
"dwinfo": "岷江南路森林小区附近",
"dwzb": "104.603919|28.765568",
"dwms": "岷江南路森林小区附近,识别宜宾市翠屏南收费站出城排放黑烟车辆",
"id": 22,
"dwip": "172.16.3.22",
"dwmc": "石海收费站",
"dwbh": 22,
"dwinfo": "兴文石海收费站附近",
"dwzb": "105.250612|28.288194",
"dwms": "石海收费站附近,抓拍自古宜高速入城黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320003012_34020000001320003012",
"video13": "/rtp/gb_play_34020000001320003013_34020000001320003013",
"video12": "/rtp/gb_play_34020000001320022012_34020000001320022012",
"video13": "/rtp/gb_play_34020000001320022013_34020000001320022013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320003016_34020000001320003016",
"play_urlhead": "rtmp://125.64.218.67:9901"
"video16": "/rtp/gb_play_34020000001320022016_34020000001320022016",
"play_urlhead": "rtmp://125.64.218.67:9901",
"qxdm": "511528",
"qxmc": "兴文县"
},
{
"id": 4,
"dwip": "172.16.3.4",
"dwmc": "南山星城",
"dwbh": 4,
"dwinfo": "一曼路南山星城南区附近",
"dwzb": "104.556797|28.718901",
"dwms": "一曼路南山星城南区附近,识别进入叙州区新城区排放黑烟车辆",
"id": 23,
"dwip": "172.16.3.23",
"dwmc": "高铁站",
"dwbh": 23,
"dwinfo": "兴文高铁站附近",
"dwzb": "105.237865|28.336993",
"dwms": "高铁站附近,抓拍自泸州纳溪区方向入城黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320004012_34020000001320004012",
"video13": "/rtp/gb_play_34020000001320004013_34020000001320004013",
"video12": "/rtp/gb_play_34020000001320023012_34020000001320023012",
"video13": "/rtp/gb_play_34020000001320023013_34020000001320023013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320004016_34020000001320004016",
"play_urlhead": "rtmp://125.64.218.67:9901"
"video16": "/rtp/gb_play_34020000001320023016_34020000001320023016",
"play_urlhead": "rtmp://125.64.218.67:9901",
"qxdm": "511528",
"qxmc": "兴文县"
},
{
"id": 5,
"dwip": "172.16.3.5",
"dwmc": "育才学校",
"dwbh": 5,
"dwinfo": "陵园路宜宾市翠屏育才学校附近",
"dwzb": "104.533476|28.699059",
"dwms": "陵园路宜宾市翠屏育才学校附近,识别叙州区老城区出城车辆排放黑烟",
"id": 24,
"dwip": "172.16.3.24",
"dwmc": "温水溪",
"dwbh": 24,
"dwinfo": "兴文温水溪加油站附近",
"dwzb": "105.246183|28.286743",
"dwms": "温水溪加油站附近,抓拍自云南威信县方向入城黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320005012_34020000001320005012",
"video13": "/rtp/gb_play_34020000001320005013_34020000001320005013",
"video12": "/rtp/gb_play_34020000001320024012_34020000001320024012",
"video13": "/rtp/gb_play_34020000001320024013_34020000001320024013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320005016_34020000001320005016",
"play_urlhead": "rtmp://125.64.218.67:9901"
"video16": "/rtp/gb_play_34020000001320024016_34020000001320024016",
"play_urlhead": "rtmp://125.64.218.67:9901",
"qxdm": "511528",
"qxmc": "兴文县"
},
{
"id": 6,
"dwip": "172.16.3.6",
"dwmc": "七星花园",
"dwbh": 6,
"dwinfo": "七星路东段七星花园小区附近",
"dwzb": "104.662376|28.755488",
"dwms": "七星路东段七星花园小区附近,识别高县入城排放黑烟车辆",
"id": 25,
"dwip": "172.16.3.25",
"dwmc": "古高路",
"dwbh": 25,
"dwinfo": "兴文古高路骨科医院附近",
"dwzb": "105.197409|28.334767",
"dwms": "古高路骨科医院附近,抓拍自长宁、江安、珙县方向和古宜高速入城黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320006012_34020000001320006012",
"video13": "/rtp/gb_play_34020000001320006013_34020000001320006013",
"video12": "/rtp/gb_play_34020000001320025012_34020000001320025012",
"video13": "/rtp/gb_play_34020000001320025013_34020000001320025013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320006016_34020000001320006016",
"play_urlhead": "rtmp://125.64.218.67:9901"
},
{
"id": 7,
"dwip": "172.16.3.7",
"dwmc": "市财政局",
"dwbh": 7,
"dwinfo": "南六路宜宾市翠屏财政局附近",
"dwzb": "104.616581|28.731942",
"dwms": "南六路宜宾市翠屏财政局附近,识别高县入城排放黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320007012_34020000001320007012",
"video13": "/rtp/gb_play_34020000001320007013_34020000001320007013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320007016_34020000001320007016",
"play_urlhead": "rtmp://125.64.218.67:9901"
},
{
"id": 8,
"dwip": "172.16.3.8",
"dwmc": "宜威路",
"dwbh": 8,
"dwinfo": "宜威路7km+800m附近",
"dwzb": "104.687767|28.731159",
"dwms": "宜威路7km+800m附近,识别珙县、筠连入城排放黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320008012_34020000001320008012",
"video13": "/rtp/gb_play_34020000001320008013_34020000001320008013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320008016_34020000001320008016",
"play_urlhead": "rtmp://125.64.218.67:9901"
},
{
"id": 9,
"dwip": "172.16.3.9",
"dwmc": "宜长路",
"dwbh": 9,
"dwinfo": "新宜长路13km+700m附近",
"dwzb": "104.717384|28.763214",
"dwms": "新宜长路13km+700m附近,识别长宁、江安方向排放黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320009012_34020000001320009012",
"video13": "/rtp/gb_play_34020000001320009013_34020000001320009013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320009016_34020000001320009016",
"play_urlhead": "rtmp://125.64.218.67:9901"
},
{
"id": 10,
"dwip": "172.16.3.10",
"dwmc": "临港马家湾",
"dwbh": 10,
"dwinfo": "长江北路四段马家湾附近",
"dwzb": "104.759928|28.816636",
"dwms": "长江北路四段马家湾附近,识别南溪方向入城排放黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320010012_34020000001320010012",
"video13": "/rtp/gb_play_34020000001320010013_34020000001320010013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320010016_34020000001320010016",
"play_urlhead": "rtmp://125.64.218.67:9901"
},
{
"id": 11,
"dwip": "172.16.3.11",
"dwmc": "环城路",
"dwbh": 11,
"dwinfo": "环城路方水中心学校附近",
"dwzb": "104.641112|28.814636",
"dwms": "环城路方水中心学校附近,识别自观斗山隧道入城排放黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320011012_34020000001320011012",
"video13": "/rtp/gb_play_34020000001320011013_34020000001320011013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320011016_34020000001320011016",
"play_urlhead": "rtmp://125.64.218.67:9901"
},
{
"id": 12,
"dwip": "172.16.3.12",
"dwmc": "陶瓷厂",
"dwbh": 12,
"dwinfo": "S206省道美莲陶瓷厂附近",
"dwzb": "104.63116|28.804407",
"dwms": "S206省道美莲陶瓷厂附近,识别省道206入城排放黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320012012_34020000001320012012",
"video13": "/rtp/gb_play_34020000001320012013_34020000001320012013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320012016_34020000001320012016",
"play_urlhead": "rtmp://125.64.218.67:9901"
},
{
"id": 13,
"dwip": "172.16.3.13",
"dwmc": "鑫菁英",
"dwbh": 13,
"dwinfo": "外江路鑫菁英小区附近",
"dwzb": "104.623547|28.74798",
"dwms": "外江路鑫菁英小区附近,识别中坝大桥往高铁站排放黑烟车辆",
"dwzt": "正常",
"video12": "/rtp/gb_play_34020000001320013012_34020000001320013012",
"video13": "/rtp/gb_play_34020000001320013013_34020000001320013013",
"video14": null,
"video15": null,
"video16": "/rtp/gb_play_34020000001320013016_34020000001320013016",
"play_urlhead": "rtmp://125.64.218.67:9901"
"video16": "/rtp/gb_play_34020000001320025016_34020000001320025016",
"play_urlhead": "rtmp://125.64.218.67:9901",
"qxdm": "511528",
"qxmc": "兴文县"
}
],
"total": 13,
"total": 5,
"page": 1,
"perpage": 20
"perpage": 19
},
"msg": ""
};
@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'superplayer_home.dart';
//import 'tc_player.dart';
import 'data_file.dart';
void main() {
@@ -71,21 +70,9 @@ class _HomePageState extends State<HomePage> {
}
Future getListButton() async {
List listDw = mapDwinfo['data']['items'];
List<Widget> _listButton = [];
_listButton.addAll([
getPlayUrl(
'http://www.yibinu.edu.cn/__local/5/35/DF/264049B7E978EEE2F5849688986_05D4A6FE_152CDB8C.mp4?e=.mp4',
'yibinu'),
getPlayUrl('https://yongling8808.github.io/test/video/movie/movie.mp4', '网络视频'),
getPlayUrl(
'http://125.64.218.67:9908/video/2_6063_20210410_155327_川QKK380.mp4', '违章视频-川QKK380'),
getPlayUrl(
'http://125.64.218.67:9908/video/2_6063_20210409_140608_川Q31715.mp4', '违章视频-川Q31715'),
]);
for (Map item in listDw) {
for (Map item in mapDwinfoXwx['data']['items']) {
_listButton.add(
getPlayUrl(item["play_urlhead"] + item["video16"], '${item["dwbh"]}.' + item["dwmc"]));
}
@@ -68,7 +68,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.2"
version: "0.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -1,27 +1,27 @@
// // This is a basic Flutter widget test.
// //
// // To perform an interaction with a widget in your test, use the WidgetTester
// // utility that Flutter provides. For example, you can send tap and scroll
// // gestures. You can also use WidgetTester to find child widgets in the widget
// // tree, read text, and verify that the values of widget properties are correct.
//
// import 'package:flutter/material.dart';
// import 'package:flutter_test/flutter_test.dart';
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
// import 'package:flutter_superplayer_example/main.dart';
//
// void main() {
// testWidgets('Verify Platform version', (WidgetTester tester) async {
// // Build our app and trigger a frame.
// await tester.pumpWidget(MyApp());
//
// // Verify that platform version is retrieved.
// expect(
// find.byWidgetPredicate(
// (Widget widget) => widget is Text &&
// widget.data.startsWith('Running on:'),
// ),
// findsOneWidget,
// );
// });
// }
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
// await tester.pumpWidget(MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
),
findsOneWidget,
);
});
}
@@ -3,7 +3,7 @@
//
// Created by Lijy91 on 2020/9/4.
//
#import <SDWebImage/SDWebImage.h>
#import "FLTSuperPlayerView.h"
// FLTSuperPlayerViewController
@@ -43,6 +43,9 @@
_superPlayerView.delegate = self;
[self setControlViewType:args[@"controlViewType"]];
if (args[@"coverImageUrl"] != nil) {
[self setCoverImage:args[@"coverImageUrl"]];
}
}
return self;
}
@@ -63,17 +66,14 @@
return nil;
}
- (void)setControlViewType:(NSString *)controlViewType
{
if ([controlViewType isEqualToString:@"without"]) {
_superPlayerView.controlView = [[SPWithoutControlView alloc] initWithFrame:CGRectZero];
} else {
_superPlayerView.controlView = [[SPDefaultControlView alloc] initWithFrame:CGRectZero];
}
}
- (void)onMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([[call method] isEqualToString:@"getPlayMode"]) {
if ([[call method] isEqualToString:@"setControlViewType"]) {
[self setControlViewType:call result: result];
} else if ([[call method] isEqualToString:@"setTitle"]) {
[self setTitle:call result: result];
} else if ([[call method] isEqualToString:@"setCoverImage"]) {
[self setCoverImage:call result: result];
} else if ([[call method] isEqualToString:@"getPlayMode"]) {
[self getPlayMode:call result: result];
} else if ([[call method] isEqualToString:@"getPlayState"]) {
[self getPlayState:call result: result];
@@ -106,6 +106,42 @@
}
}
- (void)setControlViewType:(NSString *)controlViewType
{
if ([controlViewType isEqualToString:@"without"]) {
_superPlayerView.controlView = [[SPWithoutControlView alloc] initWithFrame:CGRectZero];
} else {
_superPlayerView.controlView = [[SPDefaultControlView alloc] initWithFrame:CGRectZero];
}
}
- (void)setControlViewType:(FlutterMethodCall*)call
result:(FlutterResult)result
{
NSString *controlViewType = call.arguments[@"controlViewType"];
[self setControlViewType:controlViewType];
}
- (void)setTitle:(FlutterMethodCall*)call
result:(FlutterResult)result
{
NSString *title = call.arguments[@"title"];
[_superPlayerView.controlView setTitle:title];
}
- (void)setCoverImage:(NSString *)coverImageUrl
{
[_superPlayerView.coverImageView sd_setImageWithURL:[NSURL URLWithString:coverImageUrl]];
_superPlayerView.coverImageView.alpha = 1;
}
- (void)setCoverImage:(FlutterMethodCall*)call
result:(FlutterResult)result
{
NSString *coverImageUrl = call.arguments[@"coverImageUrl"];
[self setCoverImage:coverImageUrl];
}
- (void)getPlayMode:(FlutterMethodCall*)call
result:(FlutterResult)result
{
@@ -144,7 +180,6 @@
// skip
}
- (void)playWithModel:(FlutterMethodCall*)call
result:(FlutterResult)result
{
@@ -16,6 +16,7 @@ A new flutter plugin project.
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'SDWebImage', '~> 5.0'
s.platform = :ios, '9.0'
s.default_subspec = 'SuperPlayer_Professional'
@@ -9,7 +9,8 @@ import './superplayer_model.dart';
// import './superplayer_view.dart';
class SuperPlayerController {
ObserverList<SuperPlayerListener> _listeners = ObserverList<SuperPlayerListener>();
ObserverList<SuperPlayerListener> _listeners =
ObserverList<SuperPlayerListener>();
MethodChannel _channel;
EventChannel _eventChannel;
@@ -58,7 +59,8 @@ class SuperPlayerController {
void notifyListeners(String method, dynamic data) {
assert(_debugAssertNotDisposed());
if (_listeners != null) {
final List<SuperPlayerListener> localListeners = List<SuperPlayerListener>.from(_listeners);
final List<SuperPlayerListener> localListeners =
List<SuperPlayerListener>.from(_listeners);
for (final SuperPlayerListener listener in localListeners) {
try {
if (_listeners.contains(listener)) {
@@ -116,6 +118,19 @@ class SuperPlayerController {
});
}
void setTitle(String title) {
_channel.invokeMethod('setTitle', {
'title': title,
});
}
void setCoverImage(String coverImageUrl) {
_channel.invokeMethod(
'setCoverImage',
{'coverImageUrl': coverImageUrl},
);
}
void setPlayRate(num playRate) {
_channel.invokeMethod('setPlayRate', {'playRate': playRate});
}
@@ -124,10 +139,6 @@ class SuperPlayerController {
_channel.invokeMethod('resetPlayer');
}
void toFullScreen() {
_channel.invokeMethod('toFullScreen');
}
void requestPlayMode(int playMode) {
_channel.invokeMethod('requestPlayMode', {
'playMode': playMode,
@@ -12,12 +12,14 @@ class SuperPlayerView extends StatefulWidget {
Function(SuperPlayerController controller) onSuperPlayerViewCreated;
SuperPlayerController controller;
String controlViewType;
String coverImageUrl;
SuperPlayerView({
Key key,
this.onSuperPlayerViewCreated,
this.controller,
this.controlViewType = kControlViewTypeDefault,
this.coverImageUrl,
}) : super(key: key);
@override
@@ -42,6 +44,9 @@ class _SuperPlayerViewState extends State<SuperPlayerView> {
if (oldWidget.controlViewType != widget.controlViewType) {
widget.controller.setControlViewType(widget.controlViewType);
}
if (oldWidget.coverImageUrl != widget.coverImageUrl) {
widget.controller.setCoverImage(widget.coverImageUrl);
}
super.didUpdateWidget(oldWidget);
}
@@ -49,7 +54,8 @@ class _SuperPlayerViewState extends State<SuperPlayerView> {
Widget build(BuildContext context) {
Map<String, dynamic> creationParams = {
'controlViewType': widget.controlViewType,
};
'coverImageUrl': widget.coverImageUrl,
}..removeWhere((String k, dynamic v) => v == null);
if (Platform.isAndroid) {
return AndroidView(
+1 -1
View File
@@ -1,6 +1,6 @@
name: flutter_superplayer
description: 适用于 Flutter 的腾讯云超级播放器插件
version: 0.0.2
version: 0.0.3
author: LiJianying <lijy91@foxmail.com>
homepage: https://github.com/leanflutter/flutter_superplayer