CNLivePlayerTool.swift
3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// CNLivePlayerTool.swift
// metaCode
//
// Created by zx on 2025/2/25.
// vid获取播放地址url
import Foundation
class CNLivePlayerTool:NSObject{
//判断 专辑/单集 是否需要付费
class func isPaid(product:CNLiveAlbumProductModel?) -> Bool{
var isPaid:Bool = false
if product?.check == true{
//付过费/免费
isPaid = false
}else{
if product?.albumProductType.count ?? 0 > 0{
//专辑
if product?.albumProductType == "2" || product?.albumProductType == "5"{
//人民币 ,专辑付费
isPaid = true
}else{
//免费
}
}else{
//单集
if product?.productType.count ?? 0 > 0{
//单集
if product?.productType == "2" || product?.productType == "5"{
//人民币付费 / 专辑付费
isPaid = true
}else{
//免费
}
}else{
//免费
}
}
}
return isPaid
}
//判断 专辑/单集 是否需要展示付费icon角标
class func isShowPaidIcon(product:CNLiveAlbumProductModel?) -> Bool{
var isPaid:Bool = false
if product?.albumProductType.count ?? 0 > 0{
//专辑
if product?.albumProductType == "2" || product?.albumProductType == "5"{
//人民币 ,专辑付费
isPaid = true
}else{
//免费
}
}else{
//单集
if product?.productType.count ?? 0 > 0{
//单集
if product?.productType == "2" || product?.productType == "5"{
//人民币付费 / 专辑付费
isPaid = true
}else{
//免费
}
}else{
//免费
}
}
return isPaid
}
class func vidGetPlayerUrl(contentId:String){
}
class func pushShortVideoController(contentId:String,navigationVC:UINavigationController?,slideModel:CNLiveDownSlideModel?){
//请求getAlbumMsg获取上次播放集数
//获取专辑详情(简介等)
CNLiveHomePageViewModel.getAlbumMsg(aid: contentId) { result, status in
hiddenLoading()
if status == .success{
let model = result as! CNLiveAlbumMsgModel
//短剧-跳转短剧播放页
let toIndex = model.episodeLast-1 <= 0 ? 0 : model.episodeLast-1
navigationVC?.pushViewController( CNLiveShortVideoViewController(aid: contentId, currentIndex: toIndex, slideModel: slideModel), animated: pushAnimated)
}else{
//短剧-跳转短剧播放页
navigationVC?.pushViewController(CNLiveShortVideoViewController(aid: contentId), animated: pushAnimated)
}
}
}
}