Skip to content

Commit

Permalink
marge Dev 5.2.1-0.0.5 to support/5.2.x (#3)
Browse files Browse the repository at this point in the history
* 提交鸿蒙适配与结构改造代码。--未验证

* 验证打包后修改,添加私仓配置

* fixed module.json5

* 添加har包

* 更新package.json配置

* 升级版本,修复嵌套滑动视频遮挡其他组件。

* 更新video库公仓配置,
  • Loading branch information
hu authored Dec 6, 2023
1 parent 198686a commit d7d96c1
Show file tree
Hide file tree
Showing 8 changed files with 1,872 additions and 2,333 deletions.
Binary file modified harmony/rn_video.har
Binary file not shown.
2 changes: 1 addition & 1 deletion harmony/rn_video/oh-package.json5
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"name": "rnoh-video",
"description": "",
"main": "index.ets",
"version": "0.0.4",
"version": "0.0.5",
"dependencies": {}
}
51 changes: 21 additions & 30 deletions harmony/rn_video/src/main/ets/RNCVideo.ets
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { VideoController } from './controller/VideoController';
import { PlayConstants } from './common/constants/PlayConstants';

import { CommonConstants } from './common/constants/CommonConstants';
import Logger from './common/util/Logger';

class RNCVideoSrcRequestHeaders {
key:string = ''
Expand Down Expand Up @@ -71,10 +72,7 @@ export type VideoViewDescriptor = Descriptor<'RNCVideo', RNCVideoProps>
// export type VideoViewDescriptor = Descriptor<RNC_VIDEO_TYPE, RNCVideoProps>

export interface IRNCVideo {
videoHeight: string
videoWidth: string
videoMargin: string
videoPosition: FlexAlign
onVideoLoadStart: (cUri: string) => void
onReadyForDisplay: () => void
onVideoProgress: (currentTime: number, _playableDuration:number, _seekableDuration:number) => void
Expand All @@ -95,10 +93,7 @@ export struct RNCVideo {
private unregisterDescriptorChangesListener?: () => void = undefined
private cleanupCommandCallback?: () => void = undefined

@State videoHeight: string = PlayConstants.PLAY_PAGE.PLAY_PLAYER_HEIGHT_FULL;
@State videoWidth: string = CommonConstants.FULL_PERCENT;
@State videoMargin: string = PlayConstants.PLAY_PAGE.MARGIN_ZERO;
@State videoPosition: FlexAlign = FlexAlign.Center;

private playVideoModel: VideoController = new VideoController();

Expand All @@ -114,18 +109,18 @@ export struct RNCVideo {
@Provide('disableFocusVar') disableFocus: boolean = false; /* RN侧默认是独占模式传递FALSE过来,鸿蒙默认未共享模式*/
@Provide('preventsDisplaySleepDuringVideoPlaybackVar') preventsDisplaySleepDuringVideoPlayback: boolean = true; /* 默认true*/

@Provide status: number = CommonConstants.STATUS_START;
private isResume: boolean = false

aboutToAppear() {
console.info(`RNOH in RNCVideo aboutToAppear !}`);
Logger.info(`RNOH in RNCVideo aboutToAppear !}`);
this.descriptor = this.ctx.descriptorRegistry.getDescriptor<VideoViewDescriptor>(this.tag)
console.info(`RNOH in RNCVideo descriptor props, ${JSON.stringify(this.descriptor.props)}`);
Logger.info(`RNOH in RNCVideo descriptor props, ${JSON.stringify(this.descriptor.props)}`);
this.unregisterDescriptorChangesListener = this.ctx.descriptorRegistry.subscribeToDescriptorChanges(this.tag,
(newDescriptor) => {
this.descriptor = (newDescriptor as VideoViewDescriptor)
/*------ 当RN侧属性props有更改 -------*/
console.info(`RNOH in RNCVideo descriptor change, `);
console.info(`RNOH in RNCVideo newDescriptor props, ${JSON.stringify(this.descriptor.props)}`);
Logger.info(`RNOH in RNCVideo descriptor change, `);
Logger.info(`RNOH in RNCVideo newDescriptor props, ${JSON.stringify(this.descriptor.props)}`);
this.updatePropFromDesc()
this.preparePlayer();
}
Expand All @@ -152,9 +147,9 @@ export struct RNCVideo {
(command, args:(string|number)[]) => {
if (command === 'seek') {
//seek
console.log(`[RNOH]: seek, ${JSON.stringify(args)}`)
console.log(`[RNOH]: seek, time: ${args[0]}`)
console.log(`[RNOH]: seek, tolerance: ${args[1]}`)
Logger.info(`RNOH in RNCVideo: seek, ${JSON.stringify(args)}`)
Logger.info(`RNOH in RNCVideo: seek, time: ${args[0]}`)
Logger.info(`RNOH in RNCVideo: seek, tolerance: ${args[1]}`)
this.playVideoModel.setSeekTime(Number(args[0]))
}
});
Expand Down Expand Up @@ -279,41 +274,37 @@ export struct RNCVideo {
}

async getFd(){
console.info(`RNOH in RNCVideo getFd, ${(this.src)}`);
Logger.info(`RNOH in RNCVideo getFd, ${(this.src)}`);
}

async preparePlayer() {
console.info(`RNOH in RNCVideo,preparePlayer src= ${(this.srcParam)}`);
Logger.info(`RNOH in RNCVideo,preparePlayer src= ${(this.srcParam)}`);
if (this.srcParam.startsWith('http')) {
this.type = CommonConstants.TYPE_INTERNET
this.src = this.srcParam
console.info(`RNOH in RNCVideo startsWith, finalsrc: ${(this.src)}`);
Logger.info(`RNOH in RNCVideo startsWith, finalsrc: ${(this.src)}`);
} else {
console.info(`RNOH in RNCVideo local, finalsrc: ${(this.src)}`);
Logger.info(`RNOH in RNCVideo local, finalsrc: ${(this.src)}`);
}
}

onPageHide() {
this.status = CommonConstants.STATUS_PAUSE;
Logger.info(`RNOH in RNCVideo onPageHide.`);
this.playVideoModel.pause();
this.isResume = true;
}

build() {
RNViewBase({ ctx: this.ctx, tag: this.tag }) {
Stack() {
Column () {
PlayPlayer({ playVideoModel: this.playVideoModel })
.width(this.videoWidth)
.height(this.videoHeight)
}
.height(CommonConstants.FULL_PERCENT)
.width(CommonConstants.FULL_PERCENT)
.justifyContent(this.videoPosition)
.zIndex(0)
Stack({ alignContent: Alignment.Center }) {
PlayPlayer({ playVideoModel: this.playVideoModel })
.align(Alignment.Center)
.height(CommonConstants.FULL_PERCENT)
.width(CommonConstants.FULL_PERCENT)
}
.height(CommonConstants.FULL_PERCENT)
.width(CommonConstants.FULL_PERCENT)
.backgroundColor(Color.Black)
// .backgroundColor(Color.Black)
}
}
}
6 changes: 3 additions & 3 deletions harmony/rn_video/src/main/ets/RNCVideoTurboModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import {TurboModule, TurboModuleContext} from 'rnoh';
import {TurboModule, TurboModuleContext} from 'rnoh/ts';

export class RNCVideoTurboModule extends TurboModule {

constructor(protected ctx: TurboModuleContext) {
super(ctx);
console.log('[RNOH]:RNCVideoTurboModule constructor');
// console.log('[RNOH]:RNCVideoTurboModule constructor');
}

voidFunc() {
console.log('RNOH SampleTurboModule::voidFunc');
// console.log('RNOH SampleTurboModule::voidFunc');
}


Expand Down
Loading

0 comments on commit d7d96c1

Please sign in to comment.