zhenghy

播放器修改

... ... @@ -40,7 +40,7 @@ export struct DetailPlayShortVideoPage {
@Provide progressVal: number = 0;
@Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
playVMChanged(name: string) {
playVMChanged() {
this.url = this.playVM.url
this.newsSourceName = this.playVM.newsSourceName
this.newsTitle = this.playVM.newsTitle
... ... @@ -98,7 +98,7 @@ export struct DetailPlayShortVideoPage {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
console.log('onload==')
console.log('onload==', this.contentId, this.relId, this.relType)
// this.playVM.playWithContentId(this.contentId ?? "846899373")
this.playVM.playWithIds(this.contentId ?? "846899373",
this.relId ?? "500000301942", this.relType ?? "1")
... ... @@ -155,7 +155,7 @@ export struct DetailPlayShortVideoPage {
this.playerController.continue = undefined;
}
urlChanged(name: string) {
urlChanged() {
if (this.url) {
console.log("url:" + this.url);
this.status = PlayerConstants.STATUS_START;
... ...
... ... @@ -90,57 +90,66 @@ export struct PlayerTitleComment {
.width('100%')
.alignItems(VerticalAlign.Bottom)
Slider({
value: this.progressVal,
step: 1,
style: SliderStyle.OutSet
})
.blockColor(Color.White)
.trackColor($r('app.color.track_color'))
.selectedColor($r('app.color.index_tab_selected_font_color'))
.trackThickness(1)
.width('100%')
.onChange((value: number, mode: SliderChangeMode) => {
this.playerController?.setSeekTime(value, mode);
})
Row() {
Image($r('app.media.ic_back'))
.width(44)
.aspectRatio(1)
.padding(13)
.onClick(() => {
if (this.isFullScreen) {
if (deviceInfo.deviceType != "phone") {
WindowModel.shared.getWindowSize().then((size) => {
if (size.width > size.height) {
router.back();
Column() {
Slider({
value: this.progressVal,
step: 1,
style: SliderStyle.OutSet
})
.blockColor(Color.White)
.trackColor($r('app.color.track_color'))
.selectedColor($r('app.color.index_tab_selected_font_color'))
.trackThickness(1)
.width('100%')
.onChange((value: number, mode: SliderChangeMode) => {
this.playerController?.setSeekTime(value, mode);
})
Row() {
Image($r('app.media.ic_back'))
.width(24)
.height(24)
.aspectRatio(1)
.onClick(() => {
if (this.isFullScreen) {
if (deviceInfo.deviceType != "phone") {
WindowModel.shared.getWindowSize().then((size) => {
if (size.width > size.height) {
router.back();
} else {
this.isFullScreen = !this.isFullScreen;
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);
}
})
} else {
this.isFullScreen = !this.isFullScreen;
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);
}
})
} else {
this.isFullScreen = !this.isFullScreen;
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);
}
} else {
router.back();
}
})
} else {
router.back();
}
})
TextInput({ placeholder: '说两句...', text: this.comment })
.placeholderColor(Color.White)
.placeholderFont({ size: 14 })
.fontColor(Color.White)
.fontSize(14)
.maxLines(1)
.layoutWeight(1)
.backgroundColor('#1a1a1a')
.borderRadius(2)
.margin({ left: 12 })
}
.alignItems(VerticalAlign.Center)
.padding({ left: 16, right: 16, top: 11, bottom: 11 })
}
}.backgroundColor(Color.Black)
TextInput({ placeholder: '说两句...', text: this.comment })
.placeholderColor(Color.White)
.placeholderFont({ size: 14 })
.fontColor(Color.White)
.fontSize(14)
.maxLines(1)
.layoutWeight(1)
.backgroundColor('#ccc')
.borderRadius(2)
}.alignItems(VerticalAlign.Center)
}
.width('100%')
// .height('40%')
... ...