Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions example/ohos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/node_modules
/oh_modules
/local.properties
/.idea
**/build
/.hvigor
.cxx
/.clangd
/.clang-format
/.clang-tidy
**/.test
*.har
**/BuildProfile.ets
**/oh-package-lock.json5

**/src/main/resources/rawfile/flutter_assets/
**/libs/arm64-v8a/libapp.so
**/libs/arm64-v8a/libflutter.so
**/libs/arm64-v8a/libvmservice_snapshot.so
10 changes: 10 additions & 0 deletions example/ohos/AppScope/app.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"app": {
"bundleName": "com.befovy.fijkplayer.fijkplayer_example",
"vendor": "example",
"versionCode": 1000000,
"versionName": "0.8.5",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
8 changes: 8 additions & 0 deletions example/ohos/AppScope/resources/base/element/string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "fijkplayer_example"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions example/ohos/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"signingConfig": "default",
"compatibleSdkVersion": "5.0.3(15)",
"runtimeOS": "HarmonyOS"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
7 changes: 7 additions & 0 deletions example/ohos/entry/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
15 changes: 15 additions & 0 deletions example/ohos/entry/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

{
"apiType": 'stageMode',
"buildOption": {
},
"targets": [
{
"name": "default",
"runtimeOS": "HarmonyOS"
},
{
"name": "ohosTest",
}
]
}
3 changes: 3 additions & 0 deletions example/ohos/entry/hvigorfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { hapTasks } from '@ohos/hvigor-ohos-plugin';
11 changes: 11 additions & 0 deletions example/ohos/entry/oh-package.json5
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": {
"fijkplayer": "file:../har/fijkplayer.har"
}
}
10 changes: 10 additions & 0 deletions example/ohos/entry/src/main/ets/entryability/EntryAbility.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos';
import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant';

export default class EntryAbility extends FlutterAbility {
configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
24 changes: 24 additions & 0 deletions example/ohos/entry/src/main/ets/pages/Index.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

import common from '@ohos.app.ability.common';
import { FlutterPage } from '@ohos/flutter_ohos'

let storage = LocalStorage.getShared()
const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS'

@Entry(storage)
@Component
struct Index {
private context = getContext(this) as common.UIAbilityContext
@LocalStorageLink('viewId') viewId: string = "";

build() {
Column() {
FlutterPage({ viewId: this.viewId })
}
}

onBackPress(): boolean {
this.context.eventHub.emit(EVENT_BACK_PRESS)
return true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { FlutterEngine, Log } from '@ohos/flutter_ohos';
import FijkPlugin from 'fijkplayer';

/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Ohos platform.
*/

const TAG = "GeneratedPluginRegistrant";

export class GeneratedPluginRegistrant {

static registerWith(flutterEngine: FlutterEngine) {
try {
flutterEngine.getPlugins()?.add(new FijkPlugin());
} catch (e) {
Log.e(
TAG,
"Tried to register plugins with FlutterEngine ("
+ flutterEngine
+ ") failed.");
Log.e(TAG, "Received exception while registering", e);
}
}
}
49 changes: 49 additions & 0 deletions example/ohos/entry/src/main/module.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"requestPermissions": [
{"name" : "ohos.permission.INTERNET"},
{
"name": "ohos.permission.READ_PASTEBOARD",
"reason": "$string:permission_READ_PASTEBOARD",
"usedScene": {
"abilities": [
"EntryAbility"
]
}
}
]
}
}
8 changes: 8 additions & 0 deletions example/ohos/entry/src/main/resources/base/element/color.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
20 changes: 20 additions & 0 deletions example/ohos/entry/src/main/resources/base/element/string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "fijkplayer_example"
},
{
"name": "permission_READ_PASTEBOARD",
"value": "Need to read clipboard content to support paste functionality"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"src": [
"pages/Index"
]
}
20 changes: 20 additions & 0 deletions example/ohos/entry/src/main/resources/en_US/element/string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "fijkplayer_example"
},
{
"name": "permission_READ_PASTEBOARD",
"value": "Need to read clipboard content to support paste functionality"
}
]
}
20 changes: 20 additions & 0 deletions example/ohos/entry/src/main/resources/zh_CN/element/string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "fijkplayer_example"
},
{
"name": "permission_READ_PASTEBOARD",
"value": "需要读取剪贴板内容以支持粘贴文字功能"
}
]
}
35 changes: 35 additions & 0 deletions example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'

export default function abilityTest() {
describe('ActsAbilityTest', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(function () {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
})
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('assertContain',0, function () {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
let a = 'abc'
let b = 'b'
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b)
expect(a).assertEqual(a)
})
})
}
5 changes: 5 additions & 0 deletions example/ohos/entry/src/ohosTest/ets/test/List.test.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import abilityTest from './Ability.test'

export default function testsuite() {
abilityTest()
}
Loading