Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhanglun_wd
2024-06-12 17:34:53 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
b32297af35187346ebb8ed628b0fa3b8777b03a1
b32297af
2 parents
5e3e65e1
b8115181
Merge remote-tracking branch 'origin/main' into main
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
133 additions
and
12 deletions
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow03.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerInfoComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerTitleComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerUIComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerVideoControlComponent.ets
sight_harmony/features/wdPlayer/src/main/ets/controller/WDAliPlayerController.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow03.ets
View file @
b32297a
...
...
@@ -90,7 +90,9 @@ export struct ZhSingleRow03 {
}
async aboutToAppear(): Promise<void> {
this.getReserveState();
if (HttpUtils.getUserId()) {
this.getReserveState();
}
this.loadImg = await onlyWifiLoadImg();
}
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
View file @
b32297a
...
...
@@ -43,6 +43,7 @@ export struct DetailPlayVLivePage {
@State isPlayerError: boolean = false
@State isCanplay: boolean = false
@State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗"
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor: 0xB3000000,
...
...
@@ -135,7 +136,7 @@ export struct DetailPlayVLivePage {
PlayerInfoComponent({
playerController: this.playerController,
swiperController: this.swiperController,
swiperIndex: $swiperIndex
swiperIndex: $swiperIndex
,
})
// 直播资源加载失败
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerComponent.ets
View file @
b32297a
...
...
@@ -24,7 +24,7 @@ export struct PlayerComponent {
// 播放失败
@Link isPlayerError: boolean
@Link isCanplay: boolean
@State isLarge:boolean = false
pageShowChange() {
this.playerController?.play()
}
...
...
@@ -34,7 +34,6 @@ export struct PlayerComponent {
}
aboutToAppear(){
if (this.playerController) {
this.playerController.onCanplay = () => {
this.isCanplay = true
...
...
@@ -52,6 +51,13 @@ export struct PlayerComponent {
}
}
this.playerController.onVideoSizePlayerComponentBack = (width: number, height: number) => {
if(width>height){
this.isLarge = false
}else{
this.isLarge = true
}
}
}
...
...
@@ -113,7 +119,7 @@ export struct PlayerComponent {
this.contentTrackingDict()
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, this.pageParam);
}
}).margin({ top:
195 }).height(
211)
}).margin({ top:
this.isLarge?0:195 }).height(this.isLarge?'100%':
211)
}
PictureLoading().visibility(this.isCanplay ? Visibility.None : Visibility.Visible)
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerInfoComponent.ets
View file @
b32297a
...
...
@@ -11,6 +11,7 @@ export struct PlayerInfoComponent {
@Consume isShowControl: boolean
@Link swiperIndex: number
build() {
Column() {
Swiper(this.swiperController) {
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerTitleComponent.ets
View file @
b32297a
import lottie from '@ohos/lottie'
import { ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
import { LiveFollowComponent, LottieView } from 'wdComponent/Index'
import { NumberFormatterUtils } from 'wdKit/Index'
import { NumberFormatterUtils, WindowModel } from 'wdKit/Index'
import { window } from '@kit.ArkUI'
import { WDAliPlayerController } from 'wdPlayer/Index'
import { DisplayDirection } from 'wdConstant/Index'
/**
* 沉浸式直播--- 头部标题
...
...
@@ -12,6 +15,22 @@ export struct PlayerTitleComponent {
@Consume liveRoomDataBean: LiveRoomDataBean
@Consume liveState: string
@Consume contentDetailData: ContentDetailDTO
@Consume displayDirection: DisplayDirection
@State isLarge:boolean = false
private playerController?: WDAliPlayerController
aboutToAppear(): void {
if (!this.playerController) {
return
}
this.playerController.onVideoSizePlayerTitleComponentBack = (width: number, height: number) => {
if(width>height){
this.isLarge = false
}else{
this.isLarge = true
}
}
}
aboutToDisappear(): void {
if (this.contentDetailData.liveInfo?.liveState == 'running') {
lottie.destroy('live_status_wait')
...
...
@@ -21,11 +40,42 @@ export struct PlayerTitleComponent {
build() {
Column() {
Row() {
//返回键
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.aspectRatio(1)
.visibility(this.isLarge ? Visibility.Visible : Visibility.None)
.margin({
right: 10
})
.onClick(() => {
WindowModel.shared.setPreferredOrientation(this.isLarge ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE_INVERTED)
WindowModel.shared.setSpecificSystemBarEnabled(true)
this.isLarge = false
this.displayDirection = DisplayDirection.VERTICAL
if(this.playerController){
if(this.playerController.onVideoSizePlayerComponentBack){
this.playerController.onVideoSizePlayerComponentBack(2,1);
}
if(this.playerController.onVideoSizePlayerUIComponentMethod){
this.playerController.onVideoSizePlayerUIComponentMethod(2,1);
}
}
})
Text(this.contentDetailData.newsTitle || '')
.maxLines(2)
.fontSize(16)
.fontWeight(500)
.fontColor(Color.White)
Blank().layoutWeight(1)
//分享按钮
Image($r('app.media.icon_share'))
.width(24)
.aspectRatio(1)
.visibility(this.isLarge ? Visibility.Visible : Visibility.None)
.margin({right:16})
}.margin({ bottom: 10 })
Row() {
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerUIComponent.ets
View file @
b32297a
...
...
@@ -9,12 +9,24 @@ import { PlayerVideoControlComponent } from './PlayerVideoControlComponent';
@Component
export struct PlayerUIComponent {
private playerController?: WDAliPlayerController
@State isSmall:boolean = false
@Consume isShowControl: boolean
aboutToAppear() {
if (!this.playerController) {
return
}
this.playerController.onVideoSizePlayerUIComponentMethod = (width: number, height: number) => {
if(width>height){
this.isSmall = true
}else{
this.isSmall = false
}
}
}
build() {
Stack() {
// 标题
PlayerTitleComponent()
PlayerTitleComponent(
{ playerController: this.playerController }
)
PlayerCommentComponent()
.visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible)
...
...
@@ -23,11 +35,11 @@ export struct PlayerUIComponent {
.markAnchor({ y: '100%' })
PlayerVideoControlComponent({ playerController: this.playerController })
.visibility(this.isShowControl ? Visibility.Visible : Visibility.Hidden)
.visibility(this.isShowControl ? Visibility.Visible :
this.isSmall? Visibility.Visible:
Visibility.Hidden)
.animation({ duration: 500 })
.position({ y: '100%' })
.markAnchor({ y: '100%' })
// .position({ y: '100%' })
// .markAnchor({ y: '100%' })
.margin({ top: this.isSmall?195 +211 - 105:0})
}
.height('100%')
.width('100%')
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerVideoControlComponent.ets
View file @
b32297a
import { DateFormatUtil, WDAliPlayerController } from 'wdPlayer/Index'
import { LiveRoomDataBean } from 'wdBean/Index'
import { WindowModel } from 'wdKit/Index'
import { window } from '@kit.ArkUI'
import { DisplayDirection } from 'wdConstant/Index'
@Component
...
...
@@ -11,6 +14,8 @@ export struct PlayerVideoControlComponent {
@State progressVal: number = 0;
//是否处于播放状态中
@State isPlayStatus: boolean = true
@Consume displayDirection: DisplayDirection
aboutToAppear(): void {
if (this.playerController) {
...
...
@@ -51,7 +56,34 @@ export struct PlayerVideoControlComponent {
.margin({
right: 16
})
//全屏按钮
Image($r('app.media.icon_live_player_full_screen'))
.height(32)
.width(32)
.padding(5)
.borderRadius($r('app.float.vp_16'))
.border({width:0.5})
.borderColor(0x4DFFFFFF)
.backgroundColor(0x4D222222)
.margin({right:10})
.onClick(() => {
WindowModel.shared.setSpecificSystemBarEnabled(false)
this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
WindowModel.shared.setPreferredOrientation(
window.Orientation.LANDSCAPE_INVERTED)
if(this.playerController){
if(this.playerController.onVideoSizePlayerUIComponentMethod){
this.playerController.onVideoSizePlayerUIComponentMethod(1,2)
}
if(this.playerController.onVideoSizePlayerComponentBack){
this.playerController.onVideoSizePlayerComponentBack(1,2)
}
if(this.playerController.onVideoSizePlayerTitleComponentBack){
this.playerController.onVideoSizePlayerTitleComponentBack(1,2)
}
}
})
}
.alignItems(VerticalAlign.Center)
// .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
...
...
sight_harmony/features/wdPlayer/src/main/ets/controller/WDAliPlayerController.ets
View file @
b32297a
...
...
@@ -41,7 +41,17 @@ export class WDAliPlayerController {
private startTime: number = 0
public errorCode?: number
public errorMesage?: string
//onVideoSizeChange , onVideoSizeMethod同样的方法,不同地方使用
//AliPlayerRenderView回调
public onVideoSizeChange?: (width: number, height: number) => void;
//PlayerUIComponent回调
public onVideoSizePlayerUIComponentMethod?: (width: number, height: number) => void;
//PlayerComponent
public onVideoSizePlayerComponentBack?: (width: number, height: number) => void;
//PlayerTitleComponent
public onVideoSizePlayerTitleComponentBack?: (width: number, height: number) => void;
public onBufferUpdate?: (buffered: number, duration: number) => void;
public onTimeUpdate?: (position: number, duration: number) => void;
public onVolumeUpdate?: (volume: number) => void;
...
...
@@ -170,6 +180,13 @@ export class WDAliPlayerController {
if (this.onVideoSizeChange) {
this.onVideoSizeChange(this.avPlayer?.getVideoWidth(), this.avPlayer?.getVideoHeight());
}
if(this.onVideoSizePlayerUIComponentMethod){
this.onVideoSizePlayerUIComponentMethod(this.avPlayer?.getVideoWidth(), this.avPlayer?.getVideoHeight());
}
if(this.onVideoSizePlayerTitleComponentBack){
this.onVideoSizePlayerTitleComponentBack(this.avPlayer?.getVideoWidth(), this.avPlayer?.getVideoHeight());
}
if (this.onCanplay) {
this.onCanplay()
} else {
...
...
Please
register
or
login
to post a comment