Skip to content

player_core: 修复暂停时跳转后进度移动的问题 #909

player_core: 修复暂停时跳转后进度移动的问题

player_core: 修复暂停时跳转后进度移动的问题 #909

Workflow file for this run

name: 构建 AMLL Player Tauri 桌面版本
on:
push:
branches:
- full-refractor
- dev
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
clean-pre-release:
name: 删除预发布版本的构建产物
runs-on: ubuntu-latest
steps:
- name: 删除预发布版本的构建产物
uses: mknejp/delete-release-assets@v1
with:
token: ${{ github.token }}
assets: |
*.*
tag: ${{ github.ref_name }}-player-dev
fail-if-no-assets: false
fail-if-no-release: false
build-tauri-desktop:
name: 构建 Tauri 桌面版本
needs: clean-pre-release
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-latest
args: ""
name: linux
arch: x86_64
artifact_name_suffix: linux-x64
package_extension: tar.gz
os_runner: ubuntu-latest
- platform: windows-latest
args: ""
name: windows
arch: x86_64
artifact_name_suffix: windows-x64
package_extension: zip
os_runner: windows-latest
- platform: windows-latest
args: "--target aarch64-pc-windows-msvc"
name: windows
arch: aarch64
artifact_name_suffix: windows-arm64
package_extension: zip
os_runner: windows-latest
- platform: macos-latest # arm64 二进制包
args: "--target aarch64-apple-darwin"
name: macOS
arch: aarch64
artifact_name_suffix: macos-arm64
package_extension: tar.gz
os_runner: macos-14
- platform: macos-latest # x86 二进制包
args: "--target x86_64-apple-darwin"
name: macOS
arch: x86_64
artifact_name_suffix: macos-x64
package_extension: tar.gz
os_runner: macos-latest
# - platform: macos-latest # 通用二进制包
# args: "--target universal-apple-darwin"
# name: macOS
# arch: universal
runs-on: ${{ matrix.os_runner }}
env:
BUILDER_REPO: apoint123/ffmpeg-builder
FFMPEG_VERSION_TAG: "7.1"
steps:
- uses: actions/checkout@v4
name: 克隆仓库
with:
fetch-depth: 0 # 为了正确生成开发版本号码
- name: 安装 PNPM
uses: pnpm/action-setup@v4
- name: 安装 Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: |
wasm32-unknown-unknown,${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || (matrix.platform == 'windows-latest' && matrix.arch == 'aarch64') && 'aarch64-pc-windows-msvc' || '' }}
- name: 安装系统依赖 (仅 Linux)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
libasound2-dev \
libappindicator3-dev \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
curl \
unzip \
tar
- name: 下载预编译的 FFmpeg 库 (Windows)
if: runner.os == 'Windows'
run: |
$packageName = "ffmpeg-${{ env.FFMPEG_VERSION_TAG }}-${{ matrix.artifact_name_suffix }}.${{ matrix.package_extension }}"
$downloadUrl = "https://github.com/${{ env.BUILDER_REPO }}/releases/latest/download/$packageName"
Write-Host "Downloading $packageName from $downloadUrl ..."
Invoke-WebRequest -Uri $downloadUrl -OutFile $packageName
mkdir -p vendor/ffmpeg
Write-Host "Extracting $packageName ..."
Expand-Archive -Path $packageName -DestinationPath vendor/ffmpeg_temp -Force
Move-Item -Path vendor/ffmpeg_temp/include -Destination vendor/ffmpeg/include
Move-Item -Path vendor/ffmpeg_temp/lib -Destination vendor/ffmpeg/lib
Remove-Item -Recurse -Force vendor/ffmpeg_temp
Remove-Item $packageName
Write-Host "FFmpeg library extracted to vendor/ffmpeg"
Get-ChildItem vendor/ffmpeg | Format-Table -AutoSize
shell: powershell
- name: 下载预编译的 FFmpeg 库 (Linux/macOS)
if: runner.os != 'Windows'
run: |
PACKAGE_NAME="ffmpeg-${{ env.FFMPEG_VERSION_TAG }}-${{ matrix.artifact_name_suffix }}.${{ matrix.package_extension }}"
DOWNLOAD_URL="https://github.com/${{ env.BUILDER_REPO }}/releases/latest/download/${PACKAGE_NAME}"
echo "Downloading $PACKAGE_NAME from $DOWNLOAD_URL ..."
curl -f -sL $DOWNLOAD_URL -o $PACKAGE_NAME
mkdir -p vendor/ffmpeg
echo "Extracting $PACKAGE_NAME ..."
tar -xzf $PACKAGE_NAME -C vendor/ffmpeg
rm $PACKAGE_NAME
echo "FFmpeg library extracted to vendor/ffmpeg"
ls -lR vendor/ffmpeg
shell: bash
- name: 设置 FFmpeg 环境变量
run: |
echo "FFMPEG_DIR=${{ github.workspace }}/vendor/ffmpeg" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${{ github.workspace }}/vendor/ffmpeg/lib/pkgconfig" >> $GITHUB_ENV
if [[ "$RUNNER_OS" != "Windows" ]]; then
echo "CFLAGS=-I${{ github.workspace }}/vendor/ffmpeg/include" >> $GITHUB_ENV
echo "CXXFLAGS=-I${{ github.workspace }}/vendor/ffmpeg/include" >> $GITHUB_ENV # Also set for C++ just in case
fi
if [[ "${{ matrix.platform }}" == "macos-latest" ]]; then
echo "PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig:/usr/local/lib/pkgconfig:${{ github.workspace }}/vendor/ffmpeg/lib/pkgconfig" >> $GITHUB_ENV
fi
shell: bash
- name: 安装 sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: 配置 sccache
run: |
echo "RUSTC_WRAPPER=${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }}" >> $GITHUB_ENV
echo "ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }}" >> $GITHUB_ENV
shell: bash
# macOS 自带的 Xcode LLVM 不支持 WASM 目标
- name: "macOS: 安装 LLVM 和 Clang"
uses: KyleMayes/install-llvm-action@v2
if: matrix.platform == 'macos-latest'
with:
version: "20"
- name: "macOS: 设置环境变量"
if: matrix.platform == 'macos-latest'
run: |
SDK_PATH=$(xcrun --show-sdk-path)
echo "SDK Path: $SDK_PATH"
echo "BINDGEN_EXTRA_CLANG_ARGS=-isysroot $SDK_PATH" >> $GITHUB_ENV
shell: bash
- name: 安装 wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
with:
version: "v0.13.1"
- name: 构建 AMLL Full React 包
run: |
pnpm i --frozen-lockfile --ignore-scripts
pnpm nx build player
env:
AMLL_GITHUB_IS_ACTION: true
- name: 生成开发构建版本号
run: |
node ./packages/player/scripts/gen-dev-version.mjs
- name: 构建 AMLL Player 程序并发布自动构建
uses: tauri-apps/tauri-action@v0
with:
projectPath: packages/player
tagName: ${{ github.ref_name }}-player-dev
includeUpdaterJson: true
releaseName: AMLL Player ${{ github.ref_name }} branch development build
releaseBody: |
Latest ${{ github.ref_name }} branch development build.
最新 ${{ github.ref_name }} 分支开发调试构建。
Development version may be unstable and may not work properly, please only for test purpose.
开发版本可能不稳定且可能无法正常工作,请仅用于测试目的。
Latest commits (最新提交): ${{ github.event.head_commit.message }}
prerelease: true
args: ${{ matrix.args }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
- name: 上传产物到 Action Artifact
uses: actions/upload-artifact@v4
with:
name: AMLL Player ${{matrix.name}}-${{matrix.arch}}
path: |
packages/player/src-tauri/target/**/release/bundle/**/*
packages/player/src-tauri/target/**/release/amll-player.exe
packages/player/src-tauri/target/**/release/amll-player
build-tauri-android:
name: 构建 Tauri 安卓移动版本
needs: clean-pre-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: 克隆仓库
with:
fetch-depth: 0 # 为了正确生成开发版本号码
- name: 安装 PNPM
uses: pnpm/action-setup@v4
- name: 安装 Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: "x86_64-unknown-linux-gnu,x86_64-linux-android,i686-linux-android,aarch64-linux-android,arm-linux-androideabi,armv7-linux-androideabi,thumbv7neon-linux-androideabi"
- name: 安装 wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
with:
version: "v0.13.1"
- name: 安装 wasm32 目标
run: rustup target add wasm32-unknown-unknown
- name: 安装 sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: 配置 sccache
run: |
echo "RUSTC_WRAPPER=${{ env.SCCACHE_PATH }}" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }}" >> $GITHUB_ENV
echo "ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }}" >> $GITHUB_ENV
shell: bash
- name: 安装 FFmpeg 所需系统依赖
run: |
sudo apt-get update
sudo apt-get install -y build-essential yasm nasm
- name: 设置 Android SDK/NDK
uses: android-actions/setup-android@v3
- name: 安装 NDK
run: sdkmanager --install "ndk;27.2.12479018"
env:
ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
- name: 下载并设置预编译的 FFmpeg 库 (Android)
shell: bash
env:
BUILDER_REPO: apoint123/ffmpeg-builder
FFMPEG_VERSION_TAG: "7.1"
run: |
declare -A targets
targets["aarch64-linux-android"]="ffmpeg-${FFMPEG_VERSION_TAG}-android-arm64-v8a.tar.gz"
targets["armv7-linux-androideabi"]="ffmpeg-${FFMPEG_VERSION_TAG}-android-armeabi-v7a.tar.gz"
targets["i686-linux-android"]="ffmpeg-${FFMPEG_VERSION_TAG}-android-x86.tar.gz"
targets["x86_64-linux-android"]="ffmpeg-${FFMPEG_VERSION_TAG}-android-x86_64.tar.gz"
for target in "${!targets[@]}"; do
PACKAGE_NAME="${targets[$target]}"
DOWNLOAD_URL="https://github.com/${BUILDER_REPO}/releases/latest/download/${PACKAGE_NAME}"
EXTRACT_DIR="${{ github.workspace }}/vendor/ffmpeg_${target}"
echo "Downloading $PACKAGE_NAME for $target..."
curl -f -sL $DOWNLOAD_URL -o $PACKAGE_NAME
mkdir -p $EXTRACT_DIR
echo "Extracting $PACKAGE_NAME to $EXTRACT_DIR..."
tar -xzf $PACKAGE_NAME -C $EXTRACT_DIR
rm $PACKAGE_NAME
# 例如: FFMPEG_DIR_AARCH64_LINUX_ANDROID=/github/workspace/vendor/ffmpeg_aarch64-linux-android
TARGET_ENV_VAR="FFMPEG_DIR_$(echo $target | tr '[:lower:]' '[:upper:]' | tr '-' '_')"
echo "Setting $TARGET_ENV_VAR=$EXTRACT_DIR"
echo "$TARGET_ENV_VAR=$EXTRACT_DIR" >> $GITHUB_ENV
done
- name: 构建 AMLL Full React 包
run: |
pnpm i --frozen-lockfile --ignore-scripts
pnpm nx build player
env:
AMLL_GITHUB_IS_ACTION: true
- name: 生成开发构建版本号
run: |
node ./packages/player/scripts/gen-dev-version.mjs
- name: 构建 AMLL Player 安卓移动版程序
env:
CARGO_NDK_ANDROID_PLATFORM: 26
run: |
sccache --show-stats
export NDK_HOME=$ANDROID_NDK_HOME
export JAVA_HOME=$JAVA_HOME_17_X64
pnpm -F player tauri android build --split-per-abi
sccache --show-stats
- name: 上传产物到 Action Artifact
uses: actions/upload-artifact@v4
with:
name: AMLL Player Android Universal
path: |
packages/player/src-tauri/gen/android/app/build/outputs/**/*.apk
packages/player/src-tauri/gen/android/app/build/outputs/**/*.aab