-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AstaTus/dep-har-1.5.0-preview
[QPlayer2 Harmony] 1.5.0-preview 版本发布
- Loading branch information
Showing
64 changed files
with
3,857 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/node_modules | ||
/oh_modules | ||
/local.properties | ||
/.idea | ||
**/build | ||
/.hvigor/hvigor-wrapper.js | ||
.cxx | ||
/.clangd | ||
/.clang-format | ||
/.clang-tidy | ||
/.hvigor | ||
**/.test | ||
oh-package-lock.json5 | ||
/qplayer2_core/ | ||
signingConfigs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"app": { | ||
"bundleName": "com.qiniu.qplayer2demo", | ||
"vendor": "example", | ||
"versionCode": 1000000, | ||
"versionName": "{1.5.0_preview}", | ||
"icon": "$media:app_icon", | ||
"label": "$string:app_name" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"string": [ | ||
{ | ||
"name": "app_name", | ||
"value": "qplayer2demo" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,108 @@ | ||
# QPlayer2 | ||
|
||
|
||
|
||
Qplayer2是一款跨平台的播放器SDK,除了基础的播放器能力外,更致力于各种应用场景的对接。 | ||
|
||
注:preview 版本为预览版,仅支持基础功能,其他功能将陆续开放 | ||
|
||
### 支持的平台 | ||
|
||
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 | ||
Mac | 敬请期待 | ||
Linux | 敬请期待 | ||
### qplayer2-core 功能列表 | ||
|
||
| 能力 | 亮点 | 备注 | | ||
| ------------------ | ------------------------------------------------------------ | -------------------------------- | | ||
| 媒体资源组成形式 | 一个媒体资源支持多url,比如一个音频url和一个视频url组成一个媒体资源,提升拉流速度和解封装速度 | | | ||
| 播放协议及视频类型 | http/https/rtmp flv/m3u8/mp4/flac/wav(PCM_S24LE) | 新增协议和视频类型请联系技术支持 | | ||
| 后台播放 | 支持设置是否开启后台播放 | | | ||
| seek | 支持精准/关键帧 seek 两种方式 | | | ||
|
||
|
||
|
||
## 环境要求 | ||
|
||
| 类别 | 说明 | | ||
| -------- | ---------------------------------------------------- | | ||
| 系统版本 | 版本为 3.0.0.22 的 harmony-next 手机 | | ||
| IDE 版本 | DevEco Studio NEXT Developer Beta1 version 5.0.3.300 | | ||
|
||
|
||
|
||
## 权限要求 | ||
|
||
``` | ||
{ | ||
"name": "ohos.permission.INTERNET" | ||
}, | ||
{ | ||
"name": "ohos.permission.GET_NETWORK_INFO" | ||
}, | ||
{ | ||
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING" | ||
} | ||
``` | ||
|
||
### Harmony | ||
|
||
|
||
|
||
##### 引入依赖 | ||
|
||
须在 oh-package.json5 文件中 dependencies 字段中列出引用的三方库,sdk 在demo 工程的dependency 目录下。 | ||
|
||
```awk | ||
{ | ||
"dependencies": { | ||
"@QN/QPlayer2-core" : 'file:./qplayer2_core.har', // 本地压缩包引用 | ||
} | ||
} | ||
``` | ||
|
||
##### 鉴权 | ||
|
||
| 权限 | 说明 | 鉴权失败结果 | | ||
| ---- | ------------ | ------------------- | | ||
| Base | 基础播放能力 | 播放器进入error状态 | | ||
|
||
如需使用该套sdk到其他工程中,可通过 400-808-9176 联系七牛商务开通帐号和权限 或者 通过 [工单](https://support.qiniu.com/?ref=developer.qiniu.com) 联系七牛的技术支持。 | ||
|
||
|
||
|
||
|
||
|
||
##### 接入文档 | ||
|
||
https://developer.qiniu.io/pili/12702/qplayer2-harmony | ||
|
||
|
||
|
||
##### Demo介绍 | ||
|
||
1. demo 工程内的 长视频播放页 是基于 qplayer2-core 来实现的 | ||
|
||
1. demo 下载:https://sdk-release.qnsdk.com/qplayer2-demo-v1.5.0-preview.hap | ||
|
||
1. 电脑连接 harmony next 手机,执行下方命令安装 hap 包 | ||
|
||
```awk | ||
hdc install qplayer2-demo-v1.5.0-preview.hap | ||
``` | ||
|
||
##### | ||
|
||
|
||
|
||
##### 技术支持与交流 | ||
|
||
产品及服务咨询:400-808-9176 | ||
|
||
问题反馈:如有问题请提交issue | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"app": { | ||
"products": [ | ||
{ | ||
"name": "default", | ||
"signingConfig": "default", | ||
"compatibleSdkVersion": "5.0.0(12)", | ||
"runtimeOS": "HarmonyOS" | ||
} | ||
], | ||
"buildModeSet": [ | ||
{ | ||
"name": "debug" | ||
}, | ||
{ | ||
"name": "release" | ||
} | ||
], | ||
"signingConfigs": [ | ||
{ | ||
"name": "default", | ||
"type": "HarmonyOS", | ||
"material": { | ||
"certpath": "./signingConfigs/default_harmony-next_yyr3OFuy9Ij1XS1lyLo19Qx3Qy4onG7cI3lffRXF-PI=.cer", | ||
"storePassword": "0000001BB3731156BF6AE10CC6D8F4120628C8F5916D0E02298BC3D6CCAC5ACD995AD8D0201112375C395E", | ||
"keyAlias": "debugKey", | ||
"keyPassword": "0000001B6538323D23341B8A09A1A072F078196451CFCB82D32776DE7BF9A67A0926F4B5A4D640A4D17D17", | ||
"profile": "./signingConfigs/default_harmony-next_yyr3OFuy9Ij1XS1lyLo19Qx3Qy4onG7cI3lffRXF-PI=.p7b", | ||
"signAlg": "SHA256withECDSA", | ||
"storeFile": "./signingConfigs/default_harmony-next_yyr3OFuy9Ij1XS1lyLo19Qx3Qy4onG7cI3lffRXF-PI=.p12" | ||
} | ||
} | ||
] | ||
}, | ||
"modules": [ | ||
{ | ||
"name": "qplayer2", | ||
"srcPath": "./entry", | ||
"targets": [ | ||
{ | ||
"name": "demo", | ||
"applyToProducts": [ | ||
"default" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/node_modules | ||
/oh_modules | ||
/.preview | ||
/build | ||
/.cxx | ||
/.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"apiType": "stageMode", | ||
"buildOption": { | ||
}, | ||
"buildOptionSet": [ | ||
{ | ||
"name": "release", | ||
"arkOptions": { | ||
"obfuscation": { | ||
"ruleOptions": { | ||
"enable": true, | ||
"files": [ | ||
"./obfuscation-rules.txt" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
], | ||
"targets": [ | ||
{ | ||
"name": "demo" | ||
}, | ||
{ | ||
"name": "ohosTest", | ||
} | ||
] | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { hapTasks } from '@ohos/hvigor-ohos-plugin'; | ||
|
||
export default { | ||
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ | ||
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Define project specific obfuscation rules here. | ||
# You can include the obfuscation configuration files in the current module's build-profile.json5. | ||
# | ||
# For more details, see | ||
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md | ||
|
||
# Obfuscation options: | ||
# -disable-obfuscation: disable all obfuscations | ||
# -enable-property-obfuscation: obfuscate the property names | ||
# -enable-toplevel-obfuscation: obfuscate the names in the global scope | ||
# -compact: remove unnecessary blank spaces and all line feeds | ||
# -remove-log: remove all console.* statements | ||
# -print-namecache: print the name cache that contains the mapping from the old names to new names | ||
# -apply-namecache: reuse the given cache file | ||
|
||
# Keep options: | ||
# -keep-property-name: specifies property names that you want to keep | ||
# -keep-global-name: specifies names that you want to keep in the global scope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "entry", | ||
"version": "1.0.0", | ||
"description": "Please describe the basic information.", | ||
"main": "", | ||
"author": "", | ||
"license": "", | ||
"dependencies": { | ||
"@QN/QPlayer2-core" : 'file:./dependency/qplayer2_core-harmony-1.5.0-preview.har' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import UIAbility from '@ohos.app.ability.UIAbility'; | ||
import hilog from '@ohos.hilog'; | ||
import window from '@ohos.window'; | ||
import { WantAgent, wantAgent } from '@kit.AbilityKit'; | ||
import { backgroundTaskManager } from '@kit.BackgroundTasksKit'; | ||
import { BusinessError } from '@kit.BasicServicesKit'; | ||
import AVSessionManager from '@ohos.multimedia.avsession'; | ||
|
||
function callback(err: BusinessError, data: void) { | ||
if (err) { | ||
console.error("Operation startBackgroundRunning failed Cause: " + err); | ||
} else { | ||
console.info("Operation startBackgroundRunning succeeded"); | ||
} | ||
} | ||
export default class EntryAbility extends UIAbility { | ||
|
||
onCreate(want, launchParam) { | ||
AppStorage.setOrCreate("context",this.context) | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); | ||
|
||
} | ||
|
||
onDestroy() { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); | ||
} | ||
|
||
onWindowStageCreate(windowStage: window.WindowStage) { | ||
// Main window is created, set main page for this ability | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); | ||
windowStage.loadContent('pages/Index', (err, data) => { | ||
if (err.code) { | ||
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); | ||
return; | ||
} | ||
AppStorage.setOrCreate("windowStage" , windowStage) | ||
windowStage.getMainWindowSync().setWindowBackgroundColor('#ffffffff') | ||
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); | ||
}); | ||
} | ||
|
||
onWindowStageDestroy() { | ||
// Main window is destroyed, release UI related resources | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); | ||
} | ||
|
||
onForeground() { | ||
// Ability has brought to foreground | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); | ||
} | ||
async createSession() { | ||
let type: AVSessionManager.AVSessionType = 'audio'; | ||
let session = await AVSessionManager.createAVSession(this.context,'SESSION_NAME', type); | ||
|
||
// 激活接口要在元数据、控制命令注册完成之后再执行 | ||
await session.activate(); | ||
console.info(`session create done : sessionId : ${session.sessionId}`); | ||
} | ||
onBackground() { | ||
// Ability has back to background | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); | ||
this.createSession() | ||
let wantAgentInfo : wantAgent.WantAgentInfo = { | ||
wants: [ | ||
{ | ||
bundleName: "com.qiniu.qplayer2demo", | ||
abilityName: "EntryAbility" | ||
} | ||
], | ||
// 点击通知后,动作类型 | ||
operationType: wantAgent.OperationType.START_ABILITY, | ||
requestCode: 0, | ||
// 点击通知后,动作执行属性 | ||
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] | ||
}; | ||
|
||
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj : WantAgent) => { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'getWantAgent'); | ||
backgroundTaskManager.startBackgroundRunning(this.context, | ||
backgroundTaskManager.BackgroundMode.AUDIO_PLAYBACK, wantAgentObj).then(() => { | ||
console.info("Operation startBackgroundRunning succeeded"); | ||
}).catch((err: BusinessError) => { | ||
console.error("Operation startBackgroundRunning failed Cause: " + err); | ||
}); | ||
}); | ||
} | ||
} |
Oops, something went wrong.