logo和名称替换
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import 'package:hgmj/hj_model/list_base_model.dart';
|
||||
import 'package:wydj/hj_model/list_base_model.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/hj_model/video_model.dart';
|
||||
import 'package:hgmj/hj_page/live/live_service.dart';
|
||||
import 'package:hgmj/hj_utils/date_time_util.dart';
|
||||
import 'package:hgmj/tools_base/event_bus/event_bus_util.dart';
|
||||
import 'package:hgmj/tools_base/event_bus/events.dart';
|
||||
import 'package:hgmj/tools_base/toast.dart';
|
||||
import 'package:hgmj/tools_base/global_store/store.dart';
|
||||
import 'package:wydj/hj_model/video_model.dart';
|
||||
import 'package:wydj/hj_page/live/live_service.dart';
|
||||
import 'package:wydj/hj_utils/date_time_util.dart';
|
||||
import 'package:wydj/tools_base/event_bus/event_bus_util.dart';
|
||||
import 'package:wydj/tools_base/event_bus/events.dart';
|
||||
import 'package:wydj/tools_base/toast.dart';
|
||||
import 'package:wydj/tools_base/global_store/store.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
import 'package:hgmj/hj_utils/video_view_type.dart';
|
||||
import 'package:wydj/hj_utils/video_view_type.dart';
|
||||
|
||||
import '../../alert/video/share_media_dialog.dart';
|
||||
import '../mine/mine_vip/mine_charge_vip_page.dart';
|
||||
@@ -39,7 +39,8 @@ class LiveDetailLogic extends GetxController {
|
||||
bool isDispose = false;
|
||||
|
||||
//判断播放权限
|
||||
bool get canWatchLive => DateTimeUtil.isExpireDate(globalStore.meInfo?.broadcastExpire);
|
||||
bool get canWatchLive =>
|
||||
DateTimeUtil.isExpireDate(globalStore.meInfo?.broadcastExpire);
|
||||
|
||||
LiveDetailLogic({this.anchor});
|
||||
|
||||
@@ -49,13 +50,15 @@ class LiveDetailLogic extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// 耳机/蓝牙断开、来电中断时暂停,防止外放泄露
|
||||
_pauseVideoSub = eventBus.on<PauseVideoEvent>((_) => playerController?.pause());
|
||||
_pauseVideoSub =
|
||||
eventBus.on<PauseVideoEvent>((_) => playerController?.pause());
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() async {
|
||||
super.onReady();
|
||||
Future.wait([globalStore.updateUserInfo(), loadData(initVideo: false)]).then(
|
||||
Future.wait([globalStore.updateUserInfo(), loadData(initVideo: false)])
|
||||
.then(
|
||||
(value) {
|
||||
update(); //接口调用成功刷新一次直播状态
|
||||
loadingUserInfo = false;
|
||||
@@ -89,7 +92,8 @@ class LiveDetailLogic extends GetxController {
|
||||
|
||||
try {
|
||||
await playerController?.initialize();
|
||||
if (isRetry) confirmPlatformView(); // 仅重试成功(同视频 textureView 挂、platformView 放出)才落本地
|
||||
if (isRetry)
|
||||
confirmPlatformView(); // 仅重试成功(同视频 textureView 挂、platformView 放出)才落本地
|
||||
playerController?.addListener(_listenerCallback);
|
||||
if (isDispose) {
|
||||
playerController?.pause();
|
||||
@@ -124,7 +128,8 @@ class LiveDetailLogic extends GetxController {
|
||||
|
||||
//获取直播详情
|
||||
Future loadData({bool initVideo = true}) async {
|
||||
LiveAnchor? result = await LiveService.getLiveAnchorDetail(id: anchor?.id ?? '');
|
||||
LiveAnchor? result =
|
||||
await LiveService.getLiveAnchorDetail(id: anchor?.id ?? '');
|
||||
controller?.refreshCompleted();
|
||||
if (result != null) {
|
||||
//不需要赋值图片url,因为图片随时在变,防止图片闪动
|
||||
@@ -139,7 +144,8 @@ class LiveDetailLogic extends GetxController {
|
||||
|
||||
//直播推荐列表
|
||||
loadrecommendAnchors({int pageNum = 1}) async {
|
||||
ListBaseModel<LiveAnchor>? liveMainModels = await LiveService.getLiveAnchorRecom(
|
||||
ListBaseModel<LiveAnchor>? liveMainModels =
|
||||
await LiveService.getLiveAnchorRecom(
|
||||
country: anchor?.country ?? '',
|
||||
pageNumber: pageNum,
|
||||
pageSize: 20,
|
||||
@@ -148,13 +154,16 @@ class LiveDetailLogic extends GetxController {
|
||||
if (liveMainModels != null) {
|
||||
currentPage = pageNum;
|
||||
if (currentPage == 1) recommendList.clear();
|
||||
if (liveMainModels.list != null && liveMainModels.list?.isNotEmpty == true) {
|
||||
if (liveMainModels.list != null &&
|
||||
liveMainModels.list?.isNotEmpty == true) {
|
||||
recommendList.addAll(liveMainModels.list ?? []);
|
||||
}
|
||||
}
|
||||
controller?.refreshCompleted();
|
||||
update(['recommend']);
|
||||
liveMainModels?.hasNext == true ? controller?.loadComplete() : controller?.loadNoData();
|
||||
liveMainModels?.hasNext == true
|
||||
? controller?.loadComplete()
|
||||
: controller?.loadNoData();
|
||||
}
|
||||
|
||||
loadMoreData() => loadrecommendAnchors(pageNum: currentPage + 1);
|
||||
@@ -195,6 +204,7 @@ class LiveDetailLogic extends GetxController {
|
||||
onShareAction() {
|
||||
VideoModel videoModel = VideoModel()..cover = anchor?.coverImg;
|
||||
|
||||
Get.dialog(ShareMediaDialog(videoModel: videoModel, needDecrypt: false), useSafeArea: false);
|
||||
Get.dialog(ShareMediaDialog(videoModel: videoModel, needDecrypt: false),
|
||||
useSafeArea: false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user