Skip to content

Commit 7abcb04

Browse files
usczzjianliang00
authored andcommitted
[Feature][XElement][Android] Add video element support
Add a dedicated Android LynxXElement:Video module backed by Media3, including video element registration, PlayerView-based rendering, play/pause/stop/seek UI methods, configurable playback props, and event callbacks for first frame, playing, paused, stopped, timeupdate, ended, looped, buffering, and error states. Expose the new element through the TS xelement type definitions, wire it into the Android explorer/xelement build, and add an integration demo plus Android E2E cases that exercise playback controls and loop behavior.
1 parent dc0fef7 commit 7abcb04

28 files changed

Lines changed: 2514 additions & 8 deletions

File tree

explorer/android/lynx_explorer/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ dependencies {
131131
implementation project(':LynxXElement:Refresh')
132132
implementation project(':LynxXElement:BlurView')
133133
implementation project(':LynxXElement:WebView')
134+
implementation project(':LynxXElement:Video')
134135

135136
kapt project(':LynxProcessor')
136137
compileOnly project(':LynxProcessor')

explorer/android/settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ include ':LynxXElement:BlurView'
6666
project(":LynxXElement:BlurView").projectDir = new File(rootProject.projectDir, '../../platform/android/lynx_xelement/lynx_xelement_blur_view')
6767
include ':LynxXElement:WebView'
6868
project(":LynxXElement:WebView").projectDir = new File(rootProject.projectDir, '../../platform/android/lynx_xelement/lynx_xelement_webview')
69+
include ':LynxXElement:Video'
70+
project(":LynxXElement:Video").projectDir = new File(rootProject.projectDir, '../../platform/android/lynx_xelement/lynx_xelement_video')
6971

7072
include ':ServiceAPI'
7173
project(':ServiceAPI').projectDir = new File(rootProject.projectDir, '../../platform/android/service_api')

platform/android/lynx_xelement/lynx_xelement/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ dependencies {
4444
implementation project(':LynxXElement:Markdown')
4545
implementation project(':LynxXElement:BlurView')
4646
implementation project(':LynxXElement:WebView')
47+
implementation project(':LynxXElement:Video')
4748
implementation 'io.github.scwang90:refresh-layout-kernel:3.0.0-alpha'
4849
compileOnly project(":LynxAndroid")
4950
compileOnly project(":LynxProcessor")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2026 The Lynx Authors. All rights reserved.
2+
// Licensed under the Apache License Version 2.0 that can be found in the
3+
// LICENSE file in the root directory of this source tree.
4+
5+
package com.lynx.xelement
6+
7+
import com.lynx.tasm.behavior.LynxBehavior
8+
import com.lynx.tasm.behavior.LynxContext
9+
import com.lynx.tasm.behavior.LynxGeneratorName
10+
import com.lynx.xelement.video.LynxUIVideo
11+
12+
@LynxGeneratorName(packageName = "com.lynx.xelement")
13+
@LynxBehavior(tagName = ["video"], isCreateAsync = false)
14+
open class LynxUIVideoAutoRegistry(context: LynxContext) : LynxUIVideo(context) {}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2026 The Lynx Authors. All rights reserved.
2+
// Licensed under the Apache License Version 2.0 that can be found in the
3+
// LICENSE file in the root directory of this source tree.
4+
apply plugin: 'com.android.library'
5+
apply plugin: 'kotlin-android'
6+
apply from: file("../ext.gradle")
7+
8+
android {
9+
compileSdkVersion rootProject.ext.compileSdkVersion
10+
11+
defaultConfig {
12+
minSdkVersion min_sdk_version
13+
targetSdkVersion target_sdk_version
14+
versionCode 1
15+
versionName "1.0"
16+
consumerProguardFiles 'consumer-rules.pro'
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
26+
compileOptions {
27+
sourceCompatibility JavaVersion.VERSION_1_8
28+
targetCompatibility JavaVersion.VERSION_1_8
29+
}
30+
}
31+
32+
dependencies {
33+
implementation fileTree(dir: 'libs', include: ['*.jar'])
34+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
35+
implementation("androidx.media3:media3-exoplayer:1.0.2") {
36+
exclude group: 'com.google.guava', module: 'guava'
37+
}
38+
implementation("androidx.media3:media3-ui:1.0.2") {
39+
exclude group: 'com.google.guava', module: 'guava'
40+
}
41+
implementation 'com.google.guava:guava:31.1-android'
42+
compileOnly 'androidx.annotation:annotation:1.1.0'
43+
}

platform/android/lynx_xelement/lynx_xelement_video/consumer-rules.pro

Whitespace-only changes.

platform/android/lynx_xelement/lynx_xelement_video/proguard-rules.pro

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.lynx.xelement.video">
4+
</manifest>

0 commit comments

Comments
 (0)