[+] OHOS
This commit is contained in:
496
taoyao-client-openharmony/README.md
Normal file
496
taoyao-client-openharmony/README.md
Normal file
@@ -0,0 +1,496 @@
|
||||
# 桃夭终端
|
||||
|
||||
## 支持版本
|
||||
|
||||
* SDK 9
|
||||
|
||||
## C++终端
|
||||
|
||||
* [libmediasoupclient源码](https://github.com/versatica/libmediasoupclient)
|
||||
* [libmediasoupclient文档](https://mediasoup.org/documentation/v3/libmediasoupclient)
|
||||
* [libmediasoupclient接口](https://mediasoup.org/documentation/v3/libmediasoupclient/api)
|
||||
|
||||
## 项目配置
|
||||
|
||||
* https://gitee.com/openharmony-sig/ohos_webrtc/blob/master/doc/webrtc_build.md
|
||||
|
||||
```
|
||||
# WebRTC版本:m114
|
||||
# libmediasoupclient版本:m120
|
||||
|
||||
gn gen ./out/ohos_webrtc --args='target_os="ohos" target_cpu="arm64" is_clang=true is_debug=false use_rtti=true rtc_use_h264=true use_custom_libcxx=false rtc_include_tests=false is_component_build=false treat_warnings_as_errors=false rtc_build_examples=false libyuv_include_tests=false rtc_use_dummy_audio_file_devices=true ohos_sdk_native_root="/data/dev/ohos-sdk/linux/native"'
|
||||
|
||||
ninja -C ./out/ohos_webrtc -j 32
|
||||
```
|
||||
|
||||
## openharmony-sig/ohos_webrtc
|
||||
|
||||
* https://gitee.com/openharmony-sig/ohos_webrtc
|
||||
* https://gitee.com/openharmony-sig/ohos_webrtc/tree/master/doc
|
||||
|
||||
## openharmony-tpc/chromium_third_party_webrtc
|
||||
|
||||
* https://gitee.com/openharmony-tpc
|
||||
* https://gitee.com/openharmony-tpc/chromium_third_party_webrtc
|
||||
* https://gitee.com/openharmony-tpc/chromium_third_party_ohos_prebuilts
|
||||
|
||||
## Linux(鸿蒙)
|
||||
|
||||
```
|
||||
# 编译工具
|
||||
mkdir -p /data
|
||||
cd /data
|
||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
|
||||
# 下载源码
|
||||
mkdir -p /data/webrtc
|
||||
cd /data/webrtc
|
||||
/data/depot_tools/fetch --nohooks webrtc
|
||||
#/data/depot_tools/gclient sync
|
||||
|
||||
# 切换分支
|
||||
cd src
|
||||
git checkout -b m94 branch-heads/4606
|
||||
/data/depot_tools/gclient sync
|
||||
|
||||
# 编译依赖
|
||||
./build/install-build-deps.sh
|
||||
|
||||
# 鸿蒙工具
|
||||
wget https://repo.huaweicloud.com/openharmony/os/4.0-Release/ohos-sdk-windows_linux-public.tar.gz
|
||||
|
||||
# 编译项目
|
||||
./buildtools/linux64/gn gen out/Release-clang-x64 --args='target_os="linux" target_cpu="x64" is_clang=true is_debug=false use_rtti=true rtc_use_h264=true use_custom_libcxx=true rtc_include_tests=false is_component_build=false treat_warnings_as_errors=false rtc_build_examples=false'
|
||||
./third_party/depot_tools/ninja -C out/Release-clang-x64
|
||||
|
||||
./buildtools/linux64/gn gen out/Release-clang-x86 --args='target_os="linux" target_cpu="x86" is_clang=true is_debug=false use_rtti=true rtc_use_h264=true use_custom_libcxx=true rtc_include_tests=false is_component_build=false treat_warnings_as_errors=false rtc_build_examples=false'
|
||||
./third_party/depot_tools/ninja -C out/Release-clang-x86
|
||||
|
||||
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm
|
||||
./buildtools/linux64/gn gen out/Release-clang-arm --args='target_os="linux" target_cpu="arm" is_clang=true is_debug=false use_rtti=true rtc_use_h264=true use_custom_libcxx=true rtc_include_tests=false is_component_build=false treat_warnings_as_errors=false rtc_build_examples=false'
|
||||
./third_party/depot_tools/ninja -C out/Release-clang-arm
|
||||
|
||||
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
|
||||
./buildtools/linux64/gn gen out/Release-clang-arm64 --args='target_os="linux" target_cpu="arm64" is_clang=true is_debug=false use_rtti=true rtc_use_h264=true use_custom_libcxx=true rtc_include_tests=false is_component_build=false treat_warnings_as_errors=false rtc_build_examples=false'
|
||||
./third_party/depot_tools/ninja -C out/Release-clang-arm64
|
||||
```
|
||||
|
||||
# 国产
|
||||
|
||||
> https://blog.csdn.net/oqqKuKu12/article/details/136029483
|
||||
|
||||
## aarch64
|
||||
|
||||
```
|
||||
# 安装交叉编译工具链
|
||||
sudo apt-get install binutils-aarch64-linux-gnu
|
||||
sudo apt-get install gcc-7-aarch64-linux-gnu
|
||||
sudo apt-get install g++-7-aarch64-linux-gnu
|
||||
cd /usr/bin
|
||||
sudo ln -s aarch64-linux-gnu-gcc-7 aarch64-linux-gnu-gcc
|
||||
sudo ln -s aarch64-linux-gnu-g++-7 aarch64-linux-gnu-g++
|
||||
|
||||
# 源码安装交叉工具依赖库
|
||||
cd webrtc/build/linux/sysroot_scripts
|
||||
./install-sysroot.py --arch=arm64
|
||||
|
||||
# 交叉编译
|
||||
gn gen out/Release-aarch64 --args='
|
||||
target_os="linux"
|
||||
target_cpu="arm64"
|
||||
is_clang=false
|
||||
is_debug=false
|
||||
use_rtti=true
|
||||
rtc_use_h264=true
|
||||
use_custom_libcxx=false
|
||||
rtc_include_tests=false
|
||||
is_component_build=false
|
||||
treat_warnings_as_errors=false
|
||||
rtc_build_examples=false
|
||||
symbol_level=0
|
||||
rtc_use_x11=true
|
||||
rtc_build_ssl=true
|
||||
rtc_build_tools=false
|
||||
rtc_use_pipewire=true
|
||||
rtc_enable_protobuf=false
|
||||
rtc_include_pulse_audio=false
|
||||
ffmpeg_branding="Chrome"
|
||||
proprietary_codecs=true
|
||||
use_partition_alloc=false
|
||||
'
|
||||
|
||||
ninja -C out/Release-aarch64
|
||||
```
|
||||
|
||||
## mips64el
|
||||
|
||||
```
|
||||
# 安装交叉编译工具链
|
||||
sudo apt-get install binutils-mips64el-linux-gnu
|
||||
sudo apt-get install gcc-7-mips64el-linux-gnu
|
||||
sudo apt-get install g++-7-mips64el-linux-gnu
|
||||
cd /usr/bin
|
||||
sudo ln -s mips64el-linux-gnu-gcc-7 mips64el-linux-gnu-gcc
|
||||
sudo ln -s mips64el-linux-gnu-g++-7 mips64el-linux-gnu-g++
|
||||
|
||||
# 源码安装交叉工具依赖库
|
||||
cd webrtc/build/linux/sysroot_scripts
|
||||
./install-sysroot.py --arch=mips64el
|
||||
|
||||
# 交叉编译
|
||||
gn gen out/Release-mips64el --args='
|
||||
target_os="linux"
|
||||
target_cpu="mips64el"
|
||||
is_clang=false
|
||||
is_debug=false
|
||||
use_rtti=true
|
||||
rtc_use_h264=true
|
||||
use_custom_libcxx=false
|
||||
rtc_include_tests=false
|
||||
is_component_build=false
|
||||
treat_warnings_as_errors=false
|
||||
rtc_build_examples=false
|
||||
symbol_level=0
|
||||
rtc_use_x11=true
|
||||
rtc_build_ssl=true
|
||||
rtc_build_tools=false
|
||||
rtc_use_pipewire=true
|
||||
rtc_enable_protobuf=false
|
||||
ffmpeg_branding="Chrome"
|
||||
proprietary_codecs=true
|
||||
use_partition_alloc=false
|
||||
'
|
||||
|
||||
ninja -C out/Release-mips64el
|
||||
```
|
||||
|
||||
## loongarch64
|
||||
|
||||
```
|
||||
# 安装交叉编译工具链
|
||||
cd /opt/cross_compile/loongarch64
|
||||
wget http://ftp.loongnix.cn/toolchain/gcc/release/loongarch/gcc8/loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.2.tar.xz
|
||||
xz loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.2.tar.xz
|
||||
|
||||
# 配置WebRTC添加平台支持
|
||||
cd build/toolchain/linux
|
||||
vim BUILD.gn
|
||||
gcc_toolchain("loongarch64") {
|
||||
toolprefix = "loongarch64-linux-gnu-"
|
||||
cc = "${toolprefix}gcc -w"
|
||||
cxx= "${toolprefix}g++ -w"
|
||||
ar = "${toolprefix}ar"
|
||||
ld = cxx
|
||||
readelf = "${toolprefix}readelf"
|
||||
nm = "${toolprefix}nm"
|
||||
|
||||
toolchain_args = {
|
||||
cc_wrapper = ""
|
||||
current_cpu = "loongarch64"
|
||||
current_os = "linux"
|
||||
is_clang = false
|
||||
use_goma = false
|
||||
}
|
||||
}
|
||||
|
||||
# 配置环境和sysroot
|
||||
vim ~/.profile
|
||||
export PATH=$PATH:/opt/cross_compile/loongarch64/usr/bin
|
||||
export SYSROOT="/opt/cross_compile/loongarch64/usr/sysroot"
|
||||
export CPATH=$CPATH:${SYSROOT}/usr/include:${SYSROOT}/usr/include/glib-2.0:${SYSROOT}/usr/lib/glib-2.0/include:${SYSROOT}/usr/include/gio-unix-2.0
|
||||
. ~/.profile
|
||||
|
||||
target_os="linux"
|
||||
target_cpu="mips64el"
|
||||
is_clang=false
|
||||
is_debug=false
|
||||
use_rtti=true
|
||||
rtc_use_h264=true
|
||||
use_custom_libcxx=false
|
||||
rtc_include_tests=false
|
||||
is_component_build=false
|
||||
treat_warnings_as_errors=false
|
||||
rtc_build_examples=false
|
||||
symbol_level=0
|
||||
rtc_use_x11=true
|
||||
rtc_build_ssl=true
|
||||
rtc_build_tools=false
|
||||
rtc_use_pipewire=true
|
||||
rtc_enable_protobuf=false
|
||||
ffmpeg_branding="Chrome"
|
||||
proprietary_codecs=true
|
||||
use_partition_alloc=false
|
||||
'
|
||||
|
||||
# 交叉编译
|
||||
gn gen out/Release-loongarch64 --args='
|
||||
target_os="linux"
|
||||
target_cpu="loongarch64"
|
||||
is_clang=false
|
||||
is_debug=false
|
||||
use_rtti=true
|
||||
rtc_use_h264=true
|
||||
use_custom_libcxx=false
|
||||
rtc_include_tests=false
|
||||
is_component_build=false
|
||||
treat_warnings_as_errors=false
|
||||
rtc_build_examples=false
|
||||
symbol_level=0
|
||||
rtc_use_x11=true
|
||||
rtc_build_ssl=true
|
||||
rtc_build_tools=false
|
||||
rtc_use_pipewire=false
|
||||
rtc_enable_protobuf=false
|
||||
ffmpeg_branding="Chrome"
|
||||
proprietary_codecs=true
|
||||
use_partition_alloc=false
|
||||
'
|
||||
|
||||
ninja -C out/Release-loongarch64
|
||||
```
|
||||
|
||||
# Build command for all platforms
|
||||
|
||||
> https://github.com/webrtc-sdk/webrtc-build/blob/main/docs/build.md
|
||||
|
||||
## iOS arm
|
||||
|
||||
```bash
|
||||
gn gen out/ios-arm-device --args="
|
||||
target_os = \"ios\"
|
||||
ios_enable_code_signing = false
|
||||
use_xcode_clang = true
|
||||
is_component_build = false
|
||||
target_environment = \"device\"
|
||||
target_cpu = \"arm\"
|
||||
ios_deployment_target = \"10.0\"
|
||||
enable_ios_bitcode = false
|
||||
use_goma = false
|
||||
rtc_enable_symbol_export = true
|
||||
rtc_libvpx_build_vp9 = true
|
||||
rtc_include_tests = false
|
||||
rtc_build_examples = false
|
||||
rtc_use_h264 = false
|
||||
rtc_enable_protobuf = false
|
||||
use_rtti = true
|
||||
is_debug = false
|
||||
enable_dsyms = false
|
||||
enable_stripping = true"
|
||||
|
||||
ninja -C out/ios-arm-device ios_framework_bundle
|
||||
```
|
||||
|
||||
## iOS arm64
|
||||
|
||||
```bash
|
||||
gn gen out/ios-arm64-device --args="
|
||||
target_os = \"ios\"
|
||||
ios_enable_code_signing = false
|
||||
use_xcode_clang = true
|
||||
is_component_build = false
|
||||
target_environment = \"device\"
|
||||
target_cpu = \"arm64\"
|
||||
ios_deployment_target = \"10.0\"
|
||||
enable_ios_bitcode = false
|
||||
use_goma = false
|
||||
rtc_enable_symbol_export = true
|
||||
rtc_libvpx_build_vp9 = true
|
||||
rtc_include_tests = false
|
||||
rtc_build_examples = false
|
||||
rtc_use_h264 = false
|
||||
rtc_enable_protobuf = false
|
||||
use_rtti = true
|
||||
is_debug = false
|
||||
enable_dsyms = false
|
||||
enable_stripping = true"
|
||||
|
||||
ninja -C out/ios-arm64-device ios_framework_bundle
|
||||
```
|
||||
|
||||
## iOS x64 simulator
|
||||
|
||||
```bash
|
||||
gn gen out/ios-x64-simulator --args="
|
||||
target_os = \"ios\"
|
||||
ios_enable_code_signing = false
|
||||
use_xcode_clang = true
|
||||
is_component_build = false
|
||||
target_environment = \"simulator\"
|
||||
target_cpu = \"x64\"
|
||||
ios_deployment_target = \"12.0\"
|
||||
rtc_libvpx_build_vp9 = true
|
||||
enable_ios_bitcode = false
|
||||
use_goma = false
|
||||
rtc_enable_symbol_export = true
|
||||
rtc_libvpx_build_vp9 = true
|
||||
rtc_include_tests = false
|
||||
rtc_build_examples = false
|
||||
rtc_use_h264 = false
|
||||
rtc_enable_protobuf = false
|
||||
use_rtti = true
|
||||
is_debug = false
|
||||
enable_dsyms = false
|
||||
enable_stripping = true"
|
||||
|
||||
ninja -C out/ios-x64-simulator ios_framework_bundle
|
||||
```
|
||||
|
||||
## iOS arm64 simulator
|
||||
|
||||
```bash
|
||||
gn gen out/ios-arm64-simulator --args="
|
||||
target_os = \"ios\"
|
||||
ios_enable_code_signing = false
|
||||
use_xcode_clang = true
|
||||
is_component_build = false
|
||||
target_environment = \"simulator\"
|
||||
target_cpu = \"arm64\"
|
||||
ios_deployment_target = \"12.0\"
|
||||
enable_ios_bitcode = false
|
||||
use_goma = false
|
||||
rtc_enable_symbol_export = true
|
||||
rtc_libvpx_build_vp9 = true
|
||||
rtc_include_tests = false
|
||||
rtc_build_examples = false
|
||||
rtc_use_h264 = false
|
||||
rtc_enable_protobuf = false
|
||||
use_rtti = true
|
||||
is_debug = false
|
||||
enable_dsyms = false
|
||||
enable_stripping = true"
|
||||
|
||||
ninja -C out/ios-arm64-simulator ios_framework_bundle
|
||||
```
|
||||
|
||||
## macOS X64
|
||||
|
||||
```bash
|
||||
gn gen out/macOS-x64 --args="
|
||||
target_os=\"mac\"
|
||||
target_cpu=\"x64\"
|
||||
use_xcode_clang = false
|
||||
mac_deployment_target=\"10.11\"
|
||||
is_component_build = false
|
||||
target_cpu = \"x64\"
|
||||
use_goma = false
|
||||
rtc_enable_symbol_export = true
|
||||
rtc_libvpx_build_vp9 = true
|
||||
rtc_include_tests = false
|
||||
rtc_build_examples = false
|
||||
rtc_use_h264 = false
|
||||
rtc_enable_protobuf = false
|
||||
use_rtti = true
|
||||
is_debug = false
|
||||
enable_dsyms = false
|
||||
enable_stripping = true"
|
||||
|
||||
ninja -C out/macOS-x64 mac_framework_bundle
|
||||
```
|
||||
|
||||
## macOS arm64
|
||||
|
||||
```bash
|
||||
gn gen out/macOS-arm64 --args="
|
||||
target_os=\"mac\"
|
||||
target_cpu=\"x64\"
|
||||
use_xcode_clang = false
|
||||
mac_deployment_target=\"10.11\"
|
||||
is_component_build = false
|
||||
target_cpu = \"arm64\"
|
||||
use_goma = false
|
||||
rtc_enable_symbol_export = true
|
||||
rtc_libvpx_build_vp9 = true
|
||||
rtc_include_tests = false
|
||||
rtc_build_examples = false
|
||||
rtc_use_h264 = false
|
||||
rtc_enable_protobuf = false
|
||||
use_rtti = true
|
||||
is_debug = false
|
||||
enable_dsyms = false
|
||||
enable_stripping = true"
|
||||
|
||||
ninja -C out/macOS-arm64 mac_framework_bundle
|
||||
```
|
||||
|
||||
## Create xcframework
|
||||
|
||||
Merge the arm64 and x64 libraries of macOS.
|
||||
|
||||
```bash
|
||||
mkdir -p out/mac-x64-arm64-lib
|
||||
cp -R out/macOS-x64/WebRTC.framework out/mac-x64-arm64-lib/WebRTC.framework
|
||||
lipo -create -output out/mac-x64-arm64-lib/WebRTC.framework/WebRTC out/macOS-x64/WebRTC.framework/WebRTC out/macOS-arm64/WebRTC.framework/WebRTC
|
||||
```
|
||||
|
||||
Merge the arm64 and arm libraries of iOS.
|
||||
|
||||
```bash
|
||||
mkdir -p out/ios-device-arm-arm64-lib
|
||||
cp -R out/ios-arm64-device/WebRTC.framework out/ios-device-arm-arm64-lib/WebRTC.framework
|
||||
lipo -create -output out/ios-device-arm-arm64-lib/WebRTC.framework/WebRTC out/ios-arm-device/WebRTC.framework/WebRTC out/ios-arm64-device/WebRTC.framework/WebRTC
|
||||
```
|
||||
|
||||
Merge the arm64 and x64 libraries of iOS simulator.
|
||||
|
||||
```bash
|
||||
mkdir -p out/ios-simulator-arm64-x64-lib
|
||||
cp -R out/ios-arm64-simulator/WebRTC.framework out/ios-simulator-arm64-x64-lib/WebRTC.framework
|
||||
lipo -create -output out/ios-simulator-arm64-x64-lib/WebRTC.framework/WebRTC out/ios-arm64-simulator/WebRTC.framework/WebRTC out/ios-x64-simulator/WebRTC.framework/WebRTC
|
||||
```
|
||||
|
||||
Create xcframework
|
||||
|
||||
```bash
|
||||
xcodebuild -create-xcframework \
|
||||
-framework out/ios-device-arm-arm64-lib/WebRTC.framework \
|
||||
-framework out/ios-simulator-arm64-x64-lib/WebRTC.framework \
|
||||
-framework out/mac-x64-arm64-lib/WebRTC.framework \
|
||||
-output out/WebRTC.xcframework
|
||||
cp LICENSE out/WebRTC.xcframework/
|
||||
```
|
||||
|
||||
Fix symbolic links issue for macOS
|
||||
|
||||
```
|
||||
cd out/WebRTC.xcframework/macos-arm64_x86_64/WebRTC.framework/
|
||||
mv WebRTC Versions/A/WebRTC
|
||||
ln -s Versions/Current/WebRTC WebRTC
|
||||
```
|
||||
|
||||
Create a release zip file
|
||||
|
||||
```
|
||||
cd out/
|
||||
zip --symlinks -9 -r WebRTC.xcframework.zip WebRTC.xcframework
|
||||
# hash
|
||||
shasum -a 256 WebRTC.xcframework.zip
|
||||
```
|
||||
|
||||
## Android
|
||||
|
||||
```bash
|
||||
vpython ./tools_webrtc/android/build_aar.py --build-dir webrtc_android --output ./webrtc_android/libwebrtc.aar --arch armeabi-v7a arm64-v8a x86_64 x86 --extra-gn-args 'is_java_debug=false rtc_include_tests=false rtc_use_h264=false is_component_build=false use_rtti=true rtc_build_examples=false treat_warnings_as_errors=false'
|
||||
```
|
||||
|
||||
## Linux
|
||||
|
||||
```bash
|
||||
gn gen out/Linux-x64 --args="target_os=\"linux\" target_cpu=\"x64\" is_debug=false rtc_include_tests=false rtc_use_h264=false is_component_build=false use_rtti=true use_custom_libcxx=false rtc_enable_protobuf=false"
|
||||
gn gen out/Linux-x86 --args="target_os=\"linux\" target_cpu=\"x86\" is_debug=false rtc_include_tests=false rtc_use_h264=false is_component_build=false use_rtti=true use_custom_libcxx=false rtc_enable_protobuf=false"
|
||||
```
|
||||
|
||||
## Linux ARM/ARM64
|
||||
|
||||
```bash
|
||||
gn gen out/Linux-arm --args="target_os=\"linux\" target_cpu=\"arm\" is_debug=false rtc_include_tests=false rtc_use_h264=false is_component_build=false use_rtti=true use_custom_libcxx=false rtc_enable_protobuf=false"
|
||||
gn gen out/Linux-arm64 --args="target_os=\"linux\" target_cpu=\"arm64\" is_debug=false rtc_include_tests=false rtc_use_h264=false is_component_build=false use_rtti=true use_custom_libcxx=false rtc_enable_protobuf=false"
|
||||
|
||||
```
|
||||
|
||||
## Windows
|
||||
|
||||
```console
|
||||
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
gn gen out/Windows-x64 --args="target_os=\"win\" target_cpu=\"x64\" is_debug=false rtc_include_tests=false rtc_use_h264=true ffmpeg_branding=\"Chrome\" is_component_build=false use_rtti=true use_custom_libcxx=false rtc_enable_protobuf=false"
|
||||
gn gen out/Windows-x86 --args="target_os=\"win\" target_cpu=\"x86\" is_debug=false rtc_include_tests=false rtc_use_h264=true ffmpeg_branding=\"Chrome\" is_component_build=false use_rtti=true use_custom_libcxx=false rtc_enable_protobuf=false"
|
||||
```
|
||||
14
taoyao-client-openharmony/taoyao/.gitignore
vendored
Normal file
14
taoyao-client-openharmony/taoyao/.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
.cxx
|
||||
.idea
|
||||
.test
|
||||
.hvigor
|
||||
.clangd
|
||||
.clang-tidy
|
||||
.clang-format
|
||||
local.properties
|
||||
oh-package-lock.json5
|
||||
|
||||
deps
|
||||
build
|
||||
oh_modules
|
||||
node_modules
|
||||
10
taoyao-client-openharmony/taoyao/AppScope/app.json5
Normal file
10
taoyao-client-openharmony/taoyao/AppScope/app.json5
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"app": {
|
||||
"icon" : "$media:app_icon",
|
||||
"label" : "$string:app_name",
|
||||
"vendor": "acgist",
|
||||
"bundleName" : "com.acgist.taoyao",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name" : "app_name",
|
||||
"value": "桃夭"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
41
taoyao-client-openharmony/taoyao/build-profile.json5
Normal file
41
taoyao-client-openharmony/taoyao/build-profile.json5
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"app": {
|
||||
"products": [
|
||||
{
|
||||
"name" : "default",
|
||||
"runtimeOS" : "OpenHarmony",
|
||||
"signingConfig": "default",
|
||||
"compileSdkVersion" : 11,
|
||||
"compatibleSdkVersion": 11
|
||||
}
|
||||
],
|
||||
"signingConfigs": [
|
||||
{
|
||||
"name": "default",
|
||||
"material": {
|
||||
"signAlg" : "SHA256withECDSA",
|
||||
"keyAlias": "debugKey",
|
||||
"profile" : "C:/Users/acgis/.ohos/config/openharmony/default_taoyao_RrmPaKOZ5zMCU4QlpK1kz_6UoyvfsA4RcQxqexSUJ_8=.p7b",
|
||||
"certpath" : "C:/Users/acgis/.ohos/config/openharmony/default_taoyao_RrmPaKOZ5zMCU4QlpK1kz_6UoyvfsA4RcQxqexSUJ_8=.cer",
|
||||
"storeFile" : "C:/Users/acgis/.ohos/config/openharmony/default_taoyao_RrmPaKOZ5zMCU4QlpK1kz_6UoyvfsA4RcQxqexSUJ_8=.p12",
|
||||
"keyPassword" : "0000001B8701B2982D8D56F7049724D2E89B72966750D8E2D94B37DDF1538D9D16EB00C8D4DA39EE4C0FC7",
|
||||
"storePassword": "0000001B64642A0B174393A9875F6FCDE476F4BA4682F1EF92210832926366EA9E075136DCBB6361C9D4DD"
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "media",
|
||||
"srcPath": "./media",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
16
taoyao-client-openharmony/taoyao/hvigor/hvigor-config.json5
Normal file
16
taoyao-client-openharmony/taoyao/hvigor/hvigor-config.json5
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"hvigorVersion": "3.2.4",
|
||||
"dependencies": {
|
||||
"@ohos/hvigor-ohos-plugin": "3.2.4"
|
||||
},
|
||||
"execution": {
|
||||
// "daemon" : true,
|
||||
// "analyze" : "default",
|
||||
// "parallel" : true,
|
||||
// "typeCheck" : false,
|
||||
// "incremental": true,
|
||||
},
|
||||
"logging": {
|
||||
"level": "debug"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
1
taoyao-client-openharmony/taoyao/hvigorfile.ts
Normal file
1
taoyao-client-openharmony/taoyao/hvigorfile.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { appTasks } from '@ohos/hvigor-ohos-plugin';
|
||||
48
taoyao-client-openharmony/taoyao/hvigorw
Normal file
48
taoyao-client-openharmony/taoyao/hvigorw
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Hvigor startup script, version 1.0.0
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# NODE_HOME - location of a Node home dir
|
||||
# or
|
||||
# Add /usr/local/nodejs/bin to the PATH environment variable
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
|
||||
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
|
||||
warn() {
|
||||
echo ""
|
||||
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
|
||||
}
|
||||
|
||||
error() {
|
||||
echo ""
|
||||
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
|
||||
}
|
||||
|
||||
fail() {
|
||||
error "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Determine node to start hvigor wrapper script
|
||||
if [ -n "${NODE_HOME}" ];then
|
||||
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
|
||||
if [ ! -x "$EXECUTABLE_NODE" ];then
|
||||
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
|
||||
fi
|
||||
else
|
||||
EXECUTABLE_NODE="node"
|
||||
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
|
||||
fi
|
||||
|
||||
# Check hvigor wrapper script
|
||||
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
|
||||
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
|
||||
fi
|
||||
|
||||
# start hvigor-wrapper script
|
||||
exec "${EXECUTABLE_NODE}" \
|
||||
"${HVIGOR_WRAPPER_SCRIPT}" "$@"
|
||||
64
taoyao-client-openharmony/taoyao/hvigorw.bat
Normal file
64
taoyao-client-openharmony/taoyao/hvigorw.bat
Normal file
@@ -0,0 +1,64 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Hvigor startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
|
||||
set NODE_EXE=node.exe
|
||||
|
||||
goto start
|
||||
|
||||
:start
|
||||
@rem Find node.exe
|
||||
if defined NODE_HOME goto findNodeFromNodeHome
|
||||
|
||||
%NODE_EXE% --version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the NODE_HOME variable in your environment to match the
|
||||
echo location of your NodeJs installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findNodeFromNodeHome
|
||||
set NODE_HOME=%NODE_HOME:"=%
|
||||
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
|
||||
|
||||
if exist "%NODE_EXE_PATH%" goto execute
|
||||
echo.
|
||||
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the NODE_HOME variable in your environment to match the
|
||||
echo location of your NodeJs installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Execute hvigor
|
||||
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
|
||||
|
||||
if "%ERRORLEVEL%" == "0" goto hvigorwEnd
|
||||
|
||||
:fail
|
||||
exit /b 1
|
||||
|
||||
:hvigorwEnd
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
|
||||
:end
|
||||
20
taoyao-client-openharmony/taoyao/media/build-profile.json5
Normal file
20
taoyao-client-openharmony/taoyao/media/build-profile.json5
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"apiType": "stageMode",
|
||||
"buildOption": {
|
||||
"externalNativeOptions": {
|
||||
"path": "./src/main/cpp/CMakeLists.txt",
|
||||
"cppFlags" : "",
|
||||
"arguments" : "",
|
||||
// "cppFlags" : "-D_LIBCPP_STD_VER=17",
|
||||
// "arguments" : "-DOHOS_STL=c++_static",
|
||||
// "arguments" : "-DOHOS_STL=c++_shared",
|
||||
"abiFilters": [ "arm64-v8a" ]
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"runtimeOS": "OpenHarmony",
|
||||
}
|
||||
]
|
||||
}
|
||||
1
taoyao-client-openharmony/taoyao/media/hvigorfile.ts
Normal file
1
taoyao-client-openharmony/taoyao/media/hvigorfile.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { hapTasks } from '@ohos/hvigor-ohos-plugin';
|
||||
11
taoyao-client-openharmony/taoyao/media/oh-package.json5
Normal file
11
taoyao-client-openharmony/taoyao/media/oh-package.json5
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"main" : "",
|
||||
"name" : "media",
|
||||
"author": "acgist",
|
||||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "桃夭媒体终端",
|
||||
"dependencies" : {},
|
||||
"devDependencies" : {},
|
||||
"dynamicDependencies": {}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
project(taoyao VERSION 1.0.0 LANGUAGES C CXX)
|
||||
|
||||
# Debug | Release
|
||||
#-DCMAKE_BUILD_TYPE=Debug
|
||||
#set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
# C编译选项
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c17 -O3")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c17 -O0 -g")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c17 -O3")
|
||||
|
||||
# C++编译选项
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17 -O0 -g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17 -O3")
|
||||
|
||||
set(MEDIASOUPCLIENT_LOG_DEV OFF)
|
||||
set(MEDIASOUPCLIENT_LOG_TRACE OFF)
|
||||
set(MEDIASOUPCLIENT_BUILD_TESTS OFF)
|
||||
set(LIBWEBRTC_BINARY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps/webrtc/lib/")
|
||||
set(LIBWEBRTC_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps/webrtc/src/")
|
||||
|
||||
add_subdirectory("./deps/libmediasoupclient")
|
||||
|
||||
add_library(
|
||||
${PROJECT_NAME} SHARED
|
||||
bind.cpp
|
||||
media/Room.cpp
|
||||
media/Client.cpp
|
||||
media/RoomClient.cpp
|
||||
media/LocalClient.cpp
|
||||
media/RemoteClient.cpp
|
||||
media/MediaManager.cpp
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PROJECT_NAME} PUBLIC
|
||||
"./include"
|
||||
"./deps/webrtc"
|
||||
"./deps/libmediasoupclient/include"
|
||||
"./deps/libmediasoupclient/deps/libsdptransform/include"
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME} PUBLIC
|
||||
mediasoupclient
|
||||
libace_napi.z.so
|
||||
libhilog_ndk.z.so
|
||||
)
|
||||
86
taoyao-client-openharmony/taoyao/media/src/main/cpp/bind.cpp
Normal file
86
taoyao-client-openharmony/taoyao/media/src/main/cpp/bind.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* 方法绑定
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "hilog/log.h"
|
||||
#include "napi/native_api.h"
|
||||
|
||||
#include "./include/Room.hpp"
|
||||
#include "./include/MediaManager.hpp"
|
||||
|
||||
namespace acgist {
|
||||
|
||||
acgist::MediaManager* mediaManager = nullptr;
|
||||
std::map<std::string, acgist::Room*> roomMap;
|
||||
|
||||
static void init() {
|
||||
OH_LOG_INFO(LOG_APP, "加载libtaoyao");
|
||||
// TODO:输出编码能力
|
||||
mediaManager = new MediaManager();
|
||||
mediaManager->initPeerConnectionFactory();
|
||||
}
|
||||
|
||||
static void shutdown() {
|
||||
OH_LOG_INFO(LOG_APP, "卸载libtaoyao");
|
||||
if (mediaManager != nullptr) {
|
||||
delete mediaManager;
|
||||
mediaManager = nullptr;
|
||||
}
|
||||
// this->roomMap
|
||||
}
|
||||
|
||||
static napi_value mediaConsume(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value mediaConsumerClose(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value mediaConsumerPause(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value mediaConsumerResume(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value mediaProducerClose(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value mediaProducerPause(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value mediaProducerResume(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value roomClientList(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value roomClose(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value roomEnter(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value roomExpel(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value roomInvite(napi_env env, napi_callback_info info) { return 0; }
|
||||
static napi_value roomLeave(napi_env env, napi_callback_info info) { return 0; }
|
||||
|
||||
}
|
||||
|
||||
EXTERN_C_START
|
||||
static napi_value Init(napi_env env, napi_value exports) {
|
||||
napi_property_descriptor desc[] = {
|
||||
{ "mediaConsume", nullptr, acgist::mediaConsume, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "mediaConsumerClose", nullptr, acgist::mediaConsumerClose, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "mediaConsumerPause", nullptr, acgist::mediaConsumerPause, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "mediaConsumerResume", nullptr, acgist::mediaConsumerResume, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "mediaProducerClose", nullptr, acgist::mediaProducerClose, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "mediaProducerPause", nullptr, acgist::mediaProducerPause, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "mediaProducerResume", nullptr, acgist::mediaProducerResume, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "roomClientList", nullptr, acgist::roomClientList, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "roomClose", nullptr, acgist::roomClose, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "roomEnter", nullptr, acgist::roomEnter, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "roomExpel", nullptr, acgist::roomExpel, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "roomInvite", nullptr, acgist::roomInvite, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
{ "roomLeave", nullptr, acgist::roomLeave, nullptr, nullptr, nullptr, napi_default, nullptr },
|
||||
};
|
||||
napi_define_properties(env, exports, sizeof(desc) / sizeof(napi_property_descriptor), desc);
|
||||
return exports;
|
||||
}
|
||||
EXTERN_C_END
|
||||
|
||||
static napi_module taoyaoModule = {
|
||||
.nm_version = 1,
|
||||
.nm_flags = 0,
|
||||
.nm_filename = nullptr,
|
||||
.nm_register_func = Init,
|
||||
.nm_modname = "taoyao",
|
||||
.nm_priv = ((void*) 0),
|
||||
.reserved = { 0 },
|
||||
};
|
||||
|
||||
extern "C" __attribute__((constructor)) void RegisterEntryModule(void) {
|
||||
napi_module_register(&taoyaoModule);
|
||||
acgist::init();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
#ifndef TAOYAO_AUDIOCAPTURER_H
|
||||
#define TAOYAO_AUDIOCAPTURER_H
|
||||
|
||||
#endif //TAOYAO_AUDIOCAPTURER_H
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 采集器
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
#ifndef taoyao_Capturer_HPP
|
||||
#define taoyao_Capturer_HPP
|
||||
|
||||
#include "api/media_stream_track.h"
|
||||
|
||||
namespace acgist {
|
||||
|
||||
class Capturer {
|
||||
|
||||
public:
|
||||
virtual bool start();
|
||||
virtual bool stop();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // taoyao_Capturer_HPP
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 终端
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
#ifndef taoyao_Client_HPP
|
||||
#define taoyao_Client_HPP
|
||||
|
||||
namespace acgist {
|
||||
|
||||
class Client {
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // taoyao_Client_HPP
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 房间本地终端
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
#ifndef taoyao_LocalClient_HPP
|
||||
#define taoyao_LocalClient_HPP
|
||||
|
||||
#endif // taoyao_LocalClient_HPP
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* WebRTC媒体服务
|
||||
* 提供通道等等创建
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
#ifndef taoyao_MediaManager_HPP
|
||||
#define taoyao_MediaManager_HPP
|
||||
|
||||
#include "pc/peer_connection.h"
|
||||
#include "pc/peer_connection_factory.h"
|
||||
|
||||
namespace acgist {
|
||||
|
||||
class MediaManager {
|
||||
public:
|
||||
MediaManager();
|
||||
~MediaManager();
|
||||
public:
|
||||
webrtc::PeerConnectionFactory* peerConnectionFactoryPtr;
|
||||
public:
|
||||
void initPeerConnectionFactory();
|
||||
webrtc::PeerConnection* buildPeerConnection();
|
||||
void startCapture();
|
||||
void startAudioCapture();
|
||||
void startVideoCapture();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // taoyao_MediaManager_HPP
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 房间远程终端
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
#ifndef taoyao_RemoteClient_HPP
|
||||
#define taoyao_RemoteClient_HPP
|
||||
|
||||
#endif // taoyao_RemoteClient_HPP
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 房间
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
#ifndef taoyao_Room_HPP
|
||||
#define taoyao_Room_HPP
|
||||
|
||||
namespace acgist {
|
||||
|
||||
class Room {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // taoyao_Room_HPP
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 房间终端
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
#ifndef taoyao_RoomClient_HPP
|
||||
#define taoyao_RoomClient_HPP
|
||||
|
||||
#endif // taoyao_RoomClient_HPP
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
#ifndef TAOYAO_VIDEOCAPTURER_H
|
||||
#define TAOYAO_VIDEOCAPTURER_H
|
||||
|
||||
#endif //TAOYAO_VIDEOCAPTURER_H
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "../include/MediaManager.hpp"
|
||||
|
||||
#include "api/peer_connection_interface.h"
|
||||
|
||||
acgist::MediaManager::MediaManager() {
|
||||
this->peerConnectionFactoryPtr = nullptr;
|
||||
}
|
||||
|
||||
acgist::MediaManager::~MediaManager() {
|
||||
if(this->peerConnectionFactoryPtr != nullptr) {
|
||||
// delete this->peerConnectionFactoryPtr;
|
||||
this->peerConnectionFactoryPtr->Release();
|
||||
this->peerConnectionFactoryPtr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void acgist::MediaManager::initPeerConnectionFactory() {
|
||||
webrtc::PeerConnectionFactoryDependencies dependencies;
|
||||
// webrtc::PeerConnectionFactory::Create(dependencies);
|
||||
}
|
||||
18
taoyao-client-openharmony/taoyao/media/src/main/cpp/types/libtaoyao/index.d.ts
vendored
Normal file
18
taoyao-client-openharmony/taoyao/media/src/main/cpp/types/libtaoyao/index.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
export const sessionCall : () => void;
|
||||
export const sessionPause : () => void;
|
||||
export const sessionResume : () => void;
|
||||
export const sessionExchange: () => void;
|
||||
export const sessionClose : () => void;
|
||||
export const mediaConsume : () => void;
|
||||
export const mediaConsumerClose : () => void;
|
||||
export const mediaConsumerPause : () => void;
|
||||
export const mediaConsumerResume: () => void;
|
||||
export const mediaProducerClose : () => void;
|
||||
export const mediaProducerPause : () => void;
|
||||
export const mediaProducerResume: () => void;
|
||||
export const roomClientList : () => void;
|
||||
export const roomClose : () => void;
|
||||
export const roomEnter : () => void;
|
||||
export const roomExpel : () => void;
|
||||
export const roomInvite: () => void;
|
||||
export const roomLeave : () => void;
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "libtaoyao.so",
|
||||
"types": "./index.d.ts",
|
||||
"version": "",
|
||||
"description": "桃夭媒体依赖"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import hilog from '@ohos.hilog';
|
||||
import window from '@ohos.window';
|
||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
||||
|
||||
export default class EntryAbility extends UIAbility {
|
||||
|
||||
onCreate(want, launchParam) {
|
||||
hilog.info(0x0000, 'EntryAbility', 'onCreate');
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
hilog.info(0x0000, 'EntryAbility', 'onDestroy');
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage: window.WindowStage) {
|
||||
hilog.info(0x0000, 'EntryAbility', 'onWindowStageCreate');
|
||||
windowStage.loadContent('pages/Index', (err, data) => {
|
||||
});
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
hilog.info(0x0000, 'EntryAbility', 'onWindowStageDestroy');
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
hilog.info(0x0000, 'EntryAbility', 'onForeground');
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
hilog.info(0x0000, 'EntryAbility', 'onBackground');
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
import { signal } from "../taoyao/TaoyaoSignal";
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Button("连接信令")
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.onClick(() => {
|
||||
// signal.connect();
|
||||
});
|
||||
}
|
||||
.width('50%');
|
||||
Column() {
|
||||
Button("断开信令")
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.onClick(() => {
|
||||
// signal.close();
|
||||
});
|
||||
}
|
||||
.width('50%');
|
||||
}
|
||||
.height('100%');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
class Signal {
|
||||
// 终端名称
|
||||
name: string = "鸿蒙";
|
||||
// 终端ID
|
||||
clientId: string = "harmony";
|
||||
// 终端类型
|
||||
clientType: string = "MOBILE";
|
||||
// 信令账号
|
||||
username: string = "taoyao";
|
||||
// 信令密码
|
||||
password: string = "taoyao";
|
||||
};
|
||||
|
||||
class Setting {
|
||||
|
||||
// 信令地址
|
||||
signalAddress: string = "wss://192.168.8.204:8888/websocket.signal";
|
||||
// 信令版本
|
||||
version: string = "1.0.0";
|
||||
// 信令配置
|
||||
signal: Signal = new Signal();
|
||||
|
||||
};
|
||||
|
||||
const setting = new Setting();
|
||||
|
||||
export {
|
||||
setting
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
* 信令连接
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
|
||||
import hilog from '@ohos.hilog';
|
||||
import webSocket from '@ohos.net.webSocket';
|
||||
|
||||
import { setting } from './Setting';
|
||||
import libtaoyao from 'libtaoyao.so'
|
||||
|
||||
interface BusinessError<T = void> extends Error {
|
||||
code: number;
|
||||
data?: T;
|
||||
}
|
||||
|
||||
class TaoyaoSignal {
|
||||
|
||||
// // WebSocket信令连接
|
||||
// socket: webSocket.WebSocket;
|
||||
// // 是否关闭
|
||||
// closed: boolean = false;
|
||||
// // 是否连接成功
|
||||
// connected: boolean = false;
|
||||
// // 心跳定时
|
||||
// heartbeatTimer: number;
|
||||
// // 同步请求
|
||||
// callbackMapping = new Map();
|
||||
// // 当前消息索引
|
||||
// index: number = 0;
|
||||
// // 最大消息索引
|
||||
// maxIndex: number = 999;
|
||||
// // 当前终端索引
|
||||
// clientIndex: number = 99999;
|
||||
//
|
||||
// connect() {
|
||||
// if(this.socket) {
|
||||
// this.socket.close();
|
||||
// }
|
||||
// this.connected = false;
|
||||
// hilog.info(0x0000, 'TaoyaoSignal', '连接信令:%s', setting.signalAddress);
|
||||
// this.socket = webSocket.createWebSocket();
|
||||
// this.socket.on('open', (err: BusinessError, value: Object) => {
|
||||
// hilog.info(0x0000, 'TaoyaoSignal', '打开信令:%s', setting.signalAddress);
|
||||
// this.register();
|
||||
// this.connected = true;
|
||||
// });
|
||||
// this.socket.on('message', (err: BusinessError, value: string | ArrayBuffer) => {
|
||||
// hilog.debug(0x0000, 'TaoyaoSignal', '信令消息:%s', value);
|
||||
// try {
|
||||
// this.onMessage(value);
|
||||
// } catch (error) {
|
||||
// hilog.error(0x0000, 'TaoyaoSignal', '处理信令消息异常:%s', value, error);
|
||||
// }
|
||||
// });
|
||||
// this.socket.on('close', (err: BusinessError, value: Object) => {
|
||||
// hilog.error(0x0000, 'TaoyaoSignal', '关闭信令:%s', setting.signalAddress, err);
|
||||
// this.reconnect();
|
||||
// });
|
||||
// this.socket.on('error', (err: BusinessError) => {
|
||||
// hilog.error(0x0000, 'TaoyaoSignal', '信令异常:%s', setting.signalAddress, err);
|
||||
// this.reconnect();
|
||||
// });
|
||||
// this.socket.connect(setting.signalAddress, (err: BusinessError, value: boolean) => {
|
||||
// hilog.info(0x0000, 'TaoyaoSignal', '信令连接成功:%s', setting.signalAddress);
|
||||
// });
|
||||
// };
|
||||
//
|
||||
// reconnect() {
|
||||
// if(!this.closed) {
|
||||
// setTimeout(() => this.connect(), 5000);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// close() {
|
||||
// hilog.info(0x0000, 'TaoyaoSignal', '关闭信令:%s', setting.signalAddress);
|
||||
// this.closed = true;
|
||||
// this.connected = false;
|
||||
// if(this.socket) {
|
||||
// this.socket.close();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// async register() {
|
||||
// const response: any = await this.request("client::register", {
|
||||
// name : setting.signal.name,
|
||||
// clientId : setting.signal.clientId,
|
||||
// clientType: setting.signal.clientType,
|
||||
// username : setting.signal.username,
|
||||
// password : setting.signal.password,
|
||||
// battery : 100,
|
||||
// charging : true,
|
||||
// });
|
||||
// const { body } = response;
|
||||
// const { index } = body;
|
||||
// this.clientIndex = index;
|
||||
// hilog.info(0x0000, "TaoyaoSignal", "信令注册成功:%d", index);
|
||||
// this.heartbeat();
|
||||
// }
|
||||
//
|
||||
// heartbeat() {
|
||||
// if(this.heartbeatTimer) {
|
||||
// clearInterval(this.heartbeatTimer);
|
||||
// }
|
||||
// this.heartbeatTimer = setInterval(() => {
|
||||
// this.send("client::heartbeat", {
|
||||
// battery : 100,
|
||||
// charging: true,
|
||||
// });
|
||||
// }, 30 * 1000);
|
||||
// };
|
||||
//
|
||||
// buildId() {
|
||||
// if (++this.index > this.maxIndex) {
|
||||
// this.index = 0;
|
||||
// }
|
||||
// const date = new Date();
|
||||
// return (
|
||||
// 100000000000000 * date.getDate() +
|
||||
// 1000000000000 * date.getHours() +
|
||||
// 10000000000 * date.getMinutes() +
|
||||
// 100000000 * date.getSeconds() +
|
||||
// 1000 * this.clientIndex +
|
||||
// this.index
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// send(signal, body) {
|
||||
// const header = {
|
||||
// v: setting.version,
|
||||
// id: this.buildId(),
|
||||
// signal
|
||||
// };
|
||||
// const message = {
|
||||
// header,
|
||||
// body
|
||||
// };
|
||||
// try {
|
||||
// this.socket.send(JSON.stringify(message));
|
||||
// } catch (error) {
|
||||
// hilog.error(0x0000, 'TaoyaoSignal', '发送消息异常:%o', message, error);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// async request(signal, body) {
|
||||
// const id = this.buildId();
|
||||
// return new Promise((resolve, reject) => {
|
||||
// const header = {
|
||||
// v: setting.version,
|
||||
// id,
|
||||
// signal
|
||||
// };
|
||||
// const message = {
|
||||
// header,
|
||||
// body
|
||||
// };
|
||||
// // 设置超时
|
||||
// const rejectTimeout = setTimeout(() => {
|
||||
// this.callbackMapping.delete(id);
|
||||
// reject("请求超时");
|
||||
// }, 5000);
|
||||
// // 请求回调
|
||||
// this.callbackMapping.set(id, (response) => {
|
||||
// resolve(response);
|
||||
// clearTimeout(rejectTimeout);
|
||||
// // 默认不用继续处理
|
||||
// return true;
|
||||
// });
|
||||
// // 发送消息
|
||||
// try {
|
||||
// this.socket.send(JSON.stringify(message));
|
||||
// } catch (error) {
|
||||
// hilog.error(0x0000, 'TaoyaoSignal', '发送消息异常:%o', message, error);
|
||||
// reject(error);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// onMessage(message) {
|
||||
// const json = JSON.parse(message);
|
||||
// const {
|
||||
// header,
|
||||
// body,
|
||||
// } = json;
|
||||
// const {
|
||||
// id
|
||||
// } = header;
|
||||
// if (this.callbackMapping.has(id)) {
|
||||
// hilog.info(0x0000, "TaoyaoSignal", "处理同步消息:%s", message);
|
||||
// try {
|
||||
// if(
|
||||
// this.callbackMapping.get(id)(json)
|
||||
// ) {
|
||||
// return;
|
||||
// }
|
||||
// } finally {
|
||||
// this.callbackMapping.delete(id);
|
||||
// }
|
||||
// }
|
||||
// hilog.info(0x0000, "TaoyaoSignal", "处理异步消息:%s", message);
|
||||
// // TODO
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
const signal = new TaoyaoSignal();
|
||||
|
||||
export {
|
||||
signal
|
||||
}
|
||||
57
taoyao-client-openharmony/taoyao/media/src/main/module.json5
Normal file
57
taoyao-client-openharmony/taoyao/media/src/main/module.json5
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"module": {
|
||||
"name" : "media",
|
||||
"type" : "entry",
|
||||
"pages": "$profile:main_pages",
|
||||
"description": "$string:module_desc",
|
||||
"mainElement": "EntryAbility",
|
||||
"installationFree" : false,
|
||||
"deliveryWithInstall": true,
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name" : "EntryAbility",
|
||||
"icon" : "$media:icon",
|
||||
"label": "$string:EntryAbility_label",
|
||||
"exported": true,
|
||||
"srcEntry": "./ets/entryability/EntryAbility.ts",
|
||||
"description": "$string:EntryAbility_desc",
|
||||
"startWindowIcon": "$media:icon",
|
||||
"startWindowBackground": "$color:start_window_background",
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.CAMERA",
|
||||
"usedScene": {
|
||||
"when": "always"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.INTERNET",
|
||||
"usedScene": {
|
||||
"when": "always"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.MICROPHONE",
|
||||
"usedScene": {
|
||||
"when": "always"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "start_window_background",
|
||||
"value": "#FFFFFF"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "module_desc",
|
||||
"value": "桃夭媒体服务"
|
||||
},
|
||||
{
|
||||
"name": "EntryAbility_desc",
|
||||
"value": "桃夭媒体服务"
|
||||
},
|
||||
{
|
||||
"name": "EntryAbility_label",
|
||||
"value": "桃夭"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/Index"
|
||||
]
|
||||
}
|
||||
13
taoyao-client-openharmony/taoyao/oh-package.json5
Normal file
13
taoyao-client-openharmony/taoyao/oh-package.json5
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name" : "taoyao",
|
||||
"main" : "",
|
||||
"author": "acgist",
|
||||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"description" : "桃夭鸿蒙终端",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@ohos/hamock": "1.0.0",
|
||||
"@ohos/hypium": "1.0.13"
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user