zhenghy

视频播放修改

@@ -4,6 +4,7 @@ import { ResponseDTO } from 'wdNetwork/Index'; @@ -4,6 +4,7 @@ import { ResponseDTO } from 'wdNetwork/Index';
4 import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' 4 import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
5 import { Test } from './Test' 5 import { Test } from './Test'
6 import router from '@ohos.router'; 6 import router from '@ohos.router';
  7 +import window from '@ohos.window';
7 8
8 @Entry 9 @Entry
9 @Component 10 @Component
@@ -17,6 +18,7 @@ export struct DetailVideoListPage { @@ -17,6 +18,7 @@ export struct DetailVideoListPage {
17 @State currentIndex: number = 0 18 @State currentIndex: number = 0
18 19
19 async aboutToAppear(): Promise<void> { 20 async aboutToAppear(): Promise<void> {
  21 + console.error('=================',)
20 let data: ContentDetailDTO[] = [] 22 let data: ContentDetailDTO[] = []
21 let action: Action = router.getParams() as Action 23 let action: Action = router.getParams() as Action
22 if (action) { 24 if (action) {
@@ -80,9 +82,10 @@ export struct DetailVideoListPage { @@ -80,9 +82,10 @@ export struct DetailVideoListPage {
80 // }, (item: string) => item) 82 // }, (item: string) => item)
81 83
82 } 84 }
83 - .cachedCount(2) 85 + .cachedCount(0)
84 .indicator(false) 86 .indicator(false)
85 .vertical(true) 87 .vertical(true)
  88 + .loop(false)
86 .width('100%') 89 .width('100%')
87 .height('100%') 90 .height('100%')
88 91
@@ -77,9 +77,10 @@ export struct PlayerDetailContainer { @@ -77,9 +77,10 @@ export struct PlayerDetailContainer {
77 .zIndex(1) 77 .zIndex(1)
78 } 78 }
79 .width('100%') 79 .width('100%')
  80 + .height('100%')
80 // .aspectRatio(this.isFullScreen ? 0.1 : 16 / 9.0) // 若width值确定,当aspectRatio值越小,则height值越大 81 // .aspectRatio(this.isFullScreen ? 0.1 : 16 / 9.0) // 若width值确定,当aspectRatio值越小,则height值越大
81 - .height(this.isFullScreen ? '100%' : this.buildVideoHeight())  
82 - .margin({ top: this.isFullScreen ? 0 : this.buildVideoTo() }) 82 + // .height(this.isFullScreen ? '100%' : this.buildVideoHeight())
  83 + // .margin({ top: this.isFullScreen ? 0 : this.buildVideoTo() })
83 // .margin({ bottom: this.isFullScreen ? 0 : this.buildVideoBottom() }) 84 // .margin({ bottom: this.isFullScreen ? 0 : this.buildVideoBottom() })
84 .alignRules({ 85 .alignRules({
85 top: { anchor: '__container__', align: VerticalAlign.Top }, 86 top: { anchor: '__container__', align: VerticalAlign.Top },
@@ -29,33 +29,33 @@ export struct PlayerTitleComment { @@ -29,33 +29,33 @@ export struct PlayerTitleComment {
29 29
30 build() { 30 build() {
31 Column() { 31 Column() {
32 - Column() {  
33 - Row() {  
34 - Image($r('app.media.ic_switch_orientation'))  
35 - .width(34)  
36 - .aspectRatio(1)  
37 - .objectFit(ImageFit.Contain)  
38 - .padding({ left: 10, right: 5 })  
39 - Text("全屏观看")  
40 - .fontColor(Color.White)  
41 - .fontSize('14fp')  
42 - .maxLines(2)  
43 - .layoutWeight(1)  
44 - }  
45 - .width(100)  
46 - .backgroundColor(Color.Gray)  
47 - .borderRadius(10)  
48 - .alignItems(VerticalAlign.Center)  
49 - .visibility(this.videoLandScape == 2 ? Visibility.Hidden : Visibility.Visible)  
50 - .onClick(() => {  
51 - this.isFullScreen = !this.isFullScreen;  
52 - WindowModel.shared.setPreferredOrientation(window.Orientation.LANDSCAPE);  
53 - devicePLSensorManager.devicePLSensorOn(window.Orientation.LANDSCAPE);  
54 - })  
55 - }  
56 - .width('100%')  
57 - // .margin({ bottom: 120 })  
58 - .alignItems(HorizontalAlign.Center) 32 + // Column() {
  33 + // Row() {
  34 + // Image($r('app.media.ic_switch_orientation'))
  35 + // .width(34)
  36 + // .aspectRatio(1)
  37 + // .objectFit(ImageFit.Contain)
  38 + // .padding({ left: 10, right: 5 })
  39 + // Text("全屏观看")
  40 + // .fontColor(Color.White)
  41 + // .fontSize('14fp')
  42 + // .maxLines(2)
  43 + // .layoutWeight(1)
  44 + // }
  45 + // .width(100)
  46 + // .backgroundColor(Color.Gray)
  47 + // .borderRadius(10)
  48 + // .alignItems(VerticalAlign.Center)
  49 + // .visibility(this.videoLandScape == 2 ? Visibility.Hidden : Visibility.Visible)
  50 + // .onClick(() => {
  51 + // this.isFullScreen = !this.isFullScreen;
  52 + // WindowModel.shared.setPreferredOrientation(window.Orientation.LANDSCAPE);
  53 + // devicePLSensorManager.devicePLSensorOn(window.Orientation.LANDSCAPE);
  54 + // })
  55 + // }
  56 + // .width('100%')
  57 + // // .margin({ bottom: 120 })
  58 + // .alignItems(HorizontalAlign.Center)
59 59
60 Row() { 60 Row() {
61 Column() { 61 Column() {
@@ -80,6 +80,9 @@ export struct WDPlayerRenderView { @@ -80,6 +80,9 @@ export struct WDPlayerRenderView {
80 }) 80 })
81 .onLoad(async (event) => { 81 .onLoad(async (event) => {
82 Logger.info(TAG, 'onLoad') 82 Logger.info(TAG, 'onLoad')
  83 + let surfaceId = this.xComponentController.getXComponentSurfaceId()
  84 + console.log('surfaceId===', surfaceId)
  85 + console.log('insId===', this.insId)
83 this.xComponentController.setXComponentSurfaceSize({ 86 this.xComponentController.setXComponentSurfaceSize({
84 surfaceWidth: 1920, 87 surfaceWidth: 1920,
85 surfaceHeight: 1080 88 surfaceHeight: 1080
@@ -94,7 +97,7 @@ export struct WDPlayerRenderView { @@ -94,7 +97,7 @@ export struct WDPlayerRenderView {
94 } 97 }
95 .id(this.insId) 98 .id(this.insId)
96 .onAreaChange(() => { 99 .onAreaChange(() => {
97 - this.updateLayout() 100 + // this.updateLayout()
98 }) 101 })
99 .backgroundColor("#000000") 102 .backgroundColor("#000000")
100 .justifyContent(FlexAlign.Center) 103 .justifyContent(FlexAlign.Center)