bug修改

This commit is contained in:
XiuYun CHEN 2025-06-17 13:18:34 +08:00
parent 7e3a597e92
commit 61a28b9150
4 changed files with 31 additions and 15 deletions

View File

@ -9,7 +9,7 @@ export struct VideoSelected{
Column() {
HdNav({ title: this.params.title, showRightIcon: false, showLeftIcon: true })
ListCompVideoSelect({type_uuid:this.params.uuid}).backgroundColor(Color.White).height('100%')
ListCompVideoSelect({type_uuid:this.params.uuid}).backgroundColor(Color.White).layoutWeight(1)
}.width('100%')
.height('100%').backgroundColor($r('app.color.top_bg'))
}

View File

@ -10,6 +10,7 @@ import {
} from '@polyvharmony/media-player-sdk';
import {PLVMediaDownloadSetting} from '@polyvharmony/media-player-sdk-addon-cache-down';
const mockAuthentication: PLVVodMainAccountAuthentication = {
userId: "cfb7a69a75",
secretKey: "4KtJhl9EqU"
@ -20,8 +21,8 @@ const mockAuthentication: PLVVodMainAccountAuthentication = {
// }
const mockViewerParam: PLVViewerParam = {
viewerId: "123",
viewerName: "123"
viewerId:'',
viewerName: ""
}
export class PLVMockMediaResourceData {
@ -54,9 +55,9 @@ export class PLVMockMediaResourceData {
return this.mediaResources
}
public setupMediaResourcesFromLocal(vid:string):Promise<PLVMediaResource[]> {
public setupMediaResourcesFromLocal(vid:string,param:PLVViewerParam):Promise<PLVMediaResource[]> {
return this.mediaResources = Promise.resolve([
vod(vid)
vod(vid,param)
// vod("e97dbe3e648aefc2eb6f68b96db9db6c_e"),
// vod("e97dbe3e6401ea8f76617bafe32f57e9_e"),
// vod("e97dbe3e64ed6e0aac558e43787df1b4_e"),
@ -87,21 +88,22 @@ export class PLVMockMediaResourceData {
}
private setupMediaResourcesFromServer() {
this.mediaResources = PLVGeneralApiManager.getVodVideoList(mockAuthentication, 1, 20)
.then(result => {
return result.data!.map(video => vod(video!.vid!))
})
// this.mediaResources = PLVGeneralApiManager.getVodVideoList(mockAuthentication, 1, 20)
// .then(result => {
// return result.data!.map(video => vod(video!.vid!))
// })
}
}
function vod(videoId: string): PLVVodMediaResource {
function vod(videoId: string,param:PLVViewerParam): PLVVodMediaResource {
// 默认下载路径
const defaultDownloadRoot = PLVMediaDownloadSetting.defaultSetting(PLVMediaPlayerAppContext.getInstance().appContext!).downloadRootDirectory
return {
videoId: videoId,
authentication: mockAuthentication,
viewerParam: mockViewerParam,
viewerParam:param,
// viewerParam: mockViewerParam,
scene: "vod",
localVideoSearchPaths: [defaultDownloadRoot]
}

View File

@ -1,5 +1,5 @@
import { runCatching, seconds } from '@polyvharmony/media-player-sdk';
import { BasicConstant } from '@itcast/basic'
import { runCatching, seconds ,PLVViewerParam} from '@polyvharmony/media-player-sdk';
import { BasicConstant,authStore,preferenceStore } from '@itcast/basic'
import { promptAction, router } from '@kit.ArkUI';
import { PLVMockMediaResourceData } from '../polyv/PLVMockMediaResourceData'
import {
@ -9,10 +9,15 @@ import HashMap from '@ohos.util.HashMap';
import { hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { BusinessError } from '@kit.BasicServicesKit';
import { VideoDetailModel } from '../model/VideoDetailModel'
const mockViewerParam: PLVViewerParam = {
viewerId:preferenceStore.getItemString(BasicConstant.POLVID),
viewerName: authStore.getUser().realName
}
class VideoTools {
hashMap: HashMap<string, string> = new HashMap();
getVideoDetail(video_uuid:string)
{
this.hashMap.clear();
this.hashMap.set('video_uuid', video_uuid)
hdHttp.httpReq<string>(BasicConstant.videoDetail,this.hashMap).then(async (res: HdResponse<string>) => {
@ -61,7 +66,7 @@ class VideoTools {
async goPLVMediaPlayerSingleVideoPage(vid:string,video_uuid:string)
{
const mediaResourcesResult = await runCatching(PLVMockMediaResourceData.getInstance().setupMediaResourcesFromLocal(vid))
const mediaResourcesResult = await runCatching(PLVMockMediaResourceData.getInstance().setupMediaResourcesFromLocal(vid,mockViewerParam))
if (mediaResourcesResult.success === false) {
promptAction.showToast({
message: `'视频数据初始化失败': ${mediaResourcesResult.error}`,

View File

@ -2,7 +2,7 @@ import { VideoPage,VideoGandan } from 'home'
import { MyHomePage } from 'mypage'
import { TabBarCompModel } from '../../models/TabBarCompModel'
import { TabBarItems } from '../../contants/TabBarItems'
import { BasicConstant } from '@itcast/basic'
import { BasicConstant,AESEncryptionDecryption,authStore,preferenceStore } from '@itcast/basic'
import mediaquery from '@ohos.mediaquery';
@Component
@ -17,11 +17,20 @@ export struct TabBarComp {
@Provide
toTop:boolean=false;
aboutToAppear() {
this.getPolyid()
this.listenerScreen.on('change', (mediaQueryResult) => {
this.isLandscape = mediaQueryResult.matches
})
}
async getPolyid()
{
let mobile =authStore.getUser().mobile
let mobile_encryption = mobile +BasicConstant.polvId;
let signs =await AESEncryptionDecryption.aesEncrypt(mobile_encryption,"deoep09_klodLdAo")
preferenceStore.setItemString(BasicConstant.POLVID,signs)
}
@Builder
TabBarBuilder(item: TabBarCompModel, index: number) {
Column({ space: BasicConstant.SPACE_SM }) {