Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QPlayer2 Harmony] 1.5.0-preview2 发布 #4

Merged
merged 12 commits into from
Jul 2, 2024
2 changes: 1 addition & 1 deletion AppScope/app.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"bundleName": "com.qiniu.qplayer2demo",
"vendor": "example",
"versionCode": 1000000,
"versionName": "{1.5.0_preview}",
"versionName": "{1.5.0_preview2}",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ Qplayer2是一款跨平台的播放器SDK,除了基础的播放器能力外,

注:preview 版本为预览版,仅支持基础功能,其他功能将陆续开放

播放器 SDK 合规使用说明请参考[七牛 SDK 合规使用说明](https://developer.qiniu.com/pili/12616/sdk-compliance-instructions);隐私政策说明请参考[七牛 SDK 隐私策略](https://developer.qiniu.com/pili/8027/sdk-privacy-policy)

### 支持的平台

Platform | Build Status
-------- | ------------
Android | https://github.com/pili-engineering/QPlayer2-Android
IOS |https://github.com/pili-engineering/QPlayer2-IOS
Windows | https://github.com/pili-engineering/QPlayer2-Windows
HarmonyOS NEXT | Last Version: 1.5.0-preview
HarmonyOS NEXT | Last Version: 1.5.0-preview2
Mac | 敬请期待
Linux | 敬请期待
### qplayer2-core 功能列表
Expand Down Expand Up @@ -61,7 +63,7 @@ Qplayer2是一款跨平台的播放器SDK,除了基础的播放器能力外,
```awk
{
"dependencies": {
"@QN/QPlayer2-core" : 'file:./qplayer2_core.har', // 本地压缩包引用
"@qiniu/qplayer2-core": "^1.5.0-preview2", //依赖 open harmony 中心仓
}
}
```
Expand All @@ -88,15 +90,15 @@ https://developer.qiniu.io/pili/12702/qplayer2-harmony

1. demo 工程内的 长视频播放页 是基于 qplayer2-core 来实现的

1. demo 下载:https://sdk-release.qnsdk.com/qplayer2-demo-v1.5.0-preview.hap
1. demo 下载:https://sdk-release.qiniushawn.top/qplayer2-demo-v1.5.0-preview2.hap

1. 电脑连接 harmony next 手机,执行下方命令安装 hap 包

```awk
hdc install qplayer2-demo-v1.5.0-preview.hap
hdc install qplayer2-demo-v1.5.0-preview2.hap
```

#####




Expand Down
Binary file not shown.
6 changes: 4 additions & 2 deletions entry/oh-package.json5
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"author": "",
"license": "",
"dependencies": {
"@QN/QPlayer2-core" : 'file:./dependency/qplayer2_core-harmony-1.5.0-preview.har'
}
"@qiniu/qplayer2-core": "^1.5.0-preview2"
},
"devDependencies": {},
"dynamicDependencies": {}
}
2 changes: 0 additions & 2 deletions entry/src/main/ets/pages/Index.ets
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ struct Index {
url: 'pages/view/longVideo/QLongVideoView'
},router.RouterMode.Standard,(error)=>{

// 使用默认网络解析主机名以获取所有IP地址
let ss = connection.hasDefaultNetSync();
if (error) {
console.error(`Invoke pushUrl failed, code is ${error.code}, message is ${error.message}`);
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ArrayList } from '@kit.ArkTS';
import { QMediaModel, QMediaModelBuilder } from '@QN/QPlayer2-core/qplayer2-core';
import { QMediaModel, QMediaModelBuilder } from '@qiniu/qplayer2-core/qplayer2-core';
import { QPlayerDemoStreamElement } from '../../model/longVideo/QPlayerDemoStreamElement';

export class QPlayerCreateMediaModelHelper{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { QPlayerSettingModel } from '../../model/longVideo/QPlayerSettingModel';
import dataPreferences from '@ohos.data.preferences';
import { Context } from '@kit.AbilityKit';
import { QPlayerSeek } from '@QN/QPlayer2-core/qplayer2-core';
import { QPlayerSeek } from '@qiniu/qplayer2-core/qplayer2-core';

export class QSettingPersistentStorageHelper{
static save(context : Context,settingModel : QPlayerSettingModel){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QMediaModel, QPlayerUrlType, QStreamElement } from '@QN/QPlayer2-core/qplayer2-core'
import { QMediaModel, QPlayerUrlType, QStreamElement } from '@qiniu/qplayer2-core/qplayer2-core'
import { QUrlJsonReadWriteHelper } from '../../common/helper/QUrlJsonReadWriteHelper'

@Observed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QPlayerUrlType } from '@QN/QPlayer2-core/qplayer2-core'
import { QPlayerUrlType } from '@qiniu/qplayer2-core/qplayer2-core'

export class QPlayerDemoStreamElement{
public mUserType : string = ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QPlayerSeek } from '@QN/QPlayer2-core/qplayer2-core'
import { QPlayerSeek } from '@qiniu/qplayer2-core/qplayer2-core'
import { QSettingPersistentStorageHelper } from '../../common/helper/QSettingPersistentStorageHelper'
import { Context } from '@ohos.abilityAccessCtrl'

Expand Down
10 changes: 6 additions & 4 deletions entry/src/main/ets/pages/view/longVideo/QLongVideoView.ets
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ import { QPlayerContextFactory, QIPlayerContext, QLogLevel,
QIPlayerMediaNetworkListener,
QPlayerOpenError,
QPlayerUrlType,
QIPlayerSeekListener} from '@QN/QPlayer2-core/qplayer2-core'
import { QPlayerState } from '@QN/QPlayer2-core/src/main/ets/public/enums/QPlayerState'
import { QVideoType } from '@QN/QPlayer2-core/src/main/ets/public/listeners/QIPlayerVideoDataListener'
import { QPlayerDecoderType } from '@QN/QPlayer2-core/src/main/ets/public/enums/QPlayerDecoderType'
QIPlayerSeekListener} from '@qiniu/qplayer2-core/qplayer2-core'
import { QPlayerState } from '@qiniu/qplayer2-core/src/main/ets/public/enums/QPlayerState'


@Entry
Expand Down Expand Up @@ -262,5 +260,9 @@ struct QLongVideoView {
this.mToastText = text
this.mToastText = ""
}
onBackPress(): boolean | void {
this.mPlayerContext.get_control_handler().release()
return true
}
}

4 changes: 2 additions & 2 deletions entry/src/main/ets/pages/view/longVideo/QMaskBottom.ets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { window } from '@kit.ArkUI'
import {
QIPlayerContext, QIPlayerProgressListener, QIPlayerStateChangeListener } from '@QN/QPlayer2-core/qplayer2-core'
import { QPlayerState } from '@QN/QPlayer2-core/src/main/ets/public/enums/QPlayerState'
QIPlayerContext, QIPlayerProgressListener, QIPlayerStateChangeListener } from '@qiniu/qplayer2-core/qplayer2-core'
import { QPlayerState } from '@qiniu/qplayer2-core/src/main/ets/public/enums/QPlayerState'
import { QTimestampHelper } from '../../common/helper/QTimestampHelper'
import { common } from '@kit.AbilityKit'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { QPlayerSettingModel } from '../../model/longVideo/QPlayerSettingModel'
import { Context } from '@ohos.abilityAccessCtrl'
import { ArrayList } from '@kit.ArkTS'
import App from '@system.app'
import { QIPlayerContext, QPlayerSeek } from '@QN/QPlayer2-core/qplayer2-core'
import { QIPlayerContext, QPlayerSeek } from '@qiniu/qplayer2-core/qplayer2-core'

@Component
export struct QMaskSettingView{
Expand Down
11 changes: 5 additions & 6 deletions entry/src/main/ets/pages/view/longVideo/QMaskView.ets
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { router, window } from '@kit.ArkUI'
import { common } from '@kit.AbilityKit'
import {
QIPlayerContext, QIPlayerProgressListener, QIPlayerStateChangeListener } from '@QN/QPlayer2-core/qplayer2-core'
import { QPlayerState } from '@QN/QPlayer2-core/src/main/ets/public/enums/QPlayerState'
QIPlayerContext, QIPlayerProgressListener, QIPlayerStateChangeListener } from '@qiniu/qplayer2-core/qplayer2-core'
import { QPlayerState } from '@qiniu/qplayer2-core/src/main/ets/public/enums/QPlayerState'
import { QMaskBottom } from './QMaskBottom'

@Component
Expand All @@ -20,6 +20,7 @@ export struct QMaskView{
onStateChange :(context: QIPlayerContext , state : QPlayerState)=>{
if (state == QPlayerState.RELEASE) {
console.log(`qplayerstate : release`);
router.back()
}
}
}
Expand All @@ -39,7 +40,7 @@ export struct QMaskView{
})
.onClick(()=>{
if (this.mDeviceOrientation == window.Orientation.PORTRAIT) {
router.back()
this.mPlayerContext.get_control_handler().release()
}else {
window.getLastWindow(getContext(this) as common.UIAbilityContext).then(res => {
res.setPreferredOrientation(window.Orientation.PORTRAIT, (err) => {
Expand Down Expand Up @@ -97,9 +98,7 @@ export struct QMaskView{
// this.settingDefault()
this.mPlayerContext.get_control_handler().addPlayerStateListener(this.mStateCallBack)
}
aboutToDisappear(): void {
this.mPlayerContext.get_control_handler().release()
}

orientationChange(){
if (this.mDeviceOrientation == window.Orientation.PORTRAIT) {
this.mPortraitShow = Visibility.Hidden
Expand Down
4 changes: 2 additions & 2 deletions entry/src/main/ets/pages/view/longVideo/QPlayerStatusView.ets
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { QIPlayerContext,
QIPlayerDownloadListener,
QIPlayerFPSListener,
QIPlayerRenderListener,
QIPlayerStateChangeListener } from '@QN/QPlayer2-core/qplayer2-core'
import { QPlayerState } from '@QN/QPlayer2-core/src/main/ets/public/enums/QPlayerState'
QIPlayerStateChangeListener } from '@qiniu/qplayer2-core/qplayer2-core'
import { QPlayerState } from '@qiniu/qplayer2-core/src/main/ets/public/enums/QPlayerState'

@Component
export struct QPlayerStatusView{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QIPlayerContext, QMediaModel } from '@QN/QPlayer2-core/qplayer2-core'
import { QIPlayerContext, QMediaModel } from '@qiniu/qplayer2-core/qplayer2-core'
import { QPlayerDemoMediaModel, QPlayerDemoMediaModels } from '../../model/longVideo/QPlayerDemoMediaModel'
import { QPlayerDemoStreamElement } from '../../model/longVideo/QPlayerDemoStreamElement'

Expand Down
4 changes: 2 additions & 2 deletions entry/src/main/ets/pages/view/longVideo/QPlayerView.ets
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {QSurfaceRenderView,QIPlayerContext,
QPlayerSeek,
QIPlayerStateChangeListener,
QIPlayerBufferingListener
} from '@QN/QPlayer2-core/qplayer2-core'
} from '@qiniu/qplayer2-core/qplayer2-core'
import { QPlayerDemoMediaModels } from '../../model/longVideo/QPlayerDemoMediaModel'
import { QMaskSettingView } from './QMaskSettingView'
import { QPlayerState } from '@QN/QPlayer2-core/src/main/ets/public/enums/QPlayerState'
import { QPlayerState } from '@qiniu/qplayer2-core/src/main/ets/public/enums/QPlayerState'
import { QSettingPersistentStorageHelper } from '../../common/helper/QSettingPersistentStorageHelper'
import { QPlayerSettingModel } from '../../model/longVideo/QPlayerSettingModel'
import { common } from '@kit.AbilityKit'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { QSettingPersistentStorageHelper } from '../../common/helper/QSettingPersistentStorageHelper'
import { QPlayerSettingModel } from '../../model/longVideo/QPlayerSettingModel'
import { QTitleView } from '../../common/component/QTitleView'
import { QPlayerSeek } from '@QN/QPlayer2-core/qplayer2-core'
import { QPlayerSeek } from '@qiniu/qplayer2-core/qplayer2-core'

@Entry
@Component
Expand Down
Loading