{
9 |
10 | public static AndroidMediaPlayerFactory create() {
11 | return new AndroidMediaPlayerFactory();
12 | }
13 |
14 | @Override
15 | public AndroidMediaPlayer createPlayer(Context context) {
16 | return new AndroidMediaPlayer(context);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/player/src/main/java/xyz/doikki/videoplayer/player/PlayerFactory.java:
--------------------------------------------------------------------------------
1 | package xyz.doikki.videoplayer.player;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * 此接口使用方法:
7 | * 1.继承{@link AbstractPlayer}扩展自己的播放器。
8 | * 2.继承此接口并实现{@link #createPlayer(Context)},返回步骤1中的播放器。
9 | * 可参照{@link AndroidMediaPlayer}和{@link AndroidMediaPlayerFactory}的实现。
10 | */
11 | public abstract class PlayerFactory {
12 |
13 | public abstract P createPlayer(Context context);
14 | }
15 |
--------------------------------------------------------------------------------
/player/src/main/java/xyz/doikki/videoplayer/player/ProgressManager.java:
--------------------------------------------------------------------------------
1 | package xyz.doikki.videoplayer.player;
2 |
3 | /**
4 | * 播放进度管理器,继承此接口实现自己的进度管理器。
5 | */
6 | public abstract class ProgressManager {
7 |
8 | /**
9 | * 此方法用于实现保存进度的逻辑
10 | * @param url 播放地址
11 | * @param progress 播放进度
12 | */
13 | public abstract void saveProgress(String url, long progress);
14 |
15 | /**
16 | * 此方法用于实现获取保存的进度的逻辑
17 | * @param url 播放地址
18 | * @return 保存的播放进度
19 | */
20 | public abstract long getSavedProgress(String url);
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/player/src/main/java/xyz/doikki/videoplayer/render/IRenderView.java:
--------------------------------------------------------------------------------
1 | package xyz.doikki.videoplayer.render;
2 |
3 | import android.graphics.Bitmap;
4 | import android.view.View;
5 |
6 | import androidx.annotation.NonNull;
7 |
8 | import xyz.doikki.videoplayer.player.AbstractPlayer;
9 |
10 | public interface IRenderView {
11 |
12 | /**
13 | * 关联AbstractPlayer
14 | */
15 | void attachToPlayer(@NonNull AbstractPlayer player);
16 |
17 | /**
18 | * 设置视频宽高
19 | * @param videoWidth 宽
20 | * @param videoHeight 高
21 | */
22 | void setVideoSize(int videoWidth, int videoHeight);
23 |
24 | /**
25 | * 设置视频旋转角度
26 | * @param degree 角度值
27 | */
28 | void setVideoRotation(int degree);
29 |
30 | /**
31 | * 设置screen scale type
32 | * @param scaleType 类型
33 | */
34 | void setScaleType(int scaleType);
35 |
36 | /**
37 | * 获取真实的RenderView
38 | */
39 | View getView();
40 |
41 | /**
42 | * 截图
43 | */
44 | Bitmap doScreenShot();
45 |
46 | /**
47 | * 释放资源
48 | */
49 | void release();
50 |
51 | }
--------------------------------------------------------------------------------
/player/src/main/java/xyz/doikki/videoplayer/render/RenderViewFactory.java:
--------------------------------------------------------------------------------
1 | package xyz.doikki.videoplayer.render;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * 此接口用于扩展自己的渲染View。使用方法如下:
7 | * 1.继承IRenderView实现自己的渲染View。
8 | * 2.重写createRenderView返回步骤1的渲染View。
9 | * 可参考{@link TextureRenderView}和{@link TextureRenderViewFactory}的实现。
10 | */
11 | public abstract class RenderViewFactory {
12 |
13 | public abstract IRenderView createRenderView(Context context);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/player/src/main/java/xyz/doikki/videoplayer/render/TextureRenderViewFactory.java:
--------------------------------------------------------------------------------
1 | package xyz.doikki.videoplayer.render;
2 |
3 | import android.content.Context;
4 |
5 | public class TextureRenderViewFactory extends RenderViewFactory {
6 |
7 | public static TextureRenderViewFactory create() {
8 | return new TextureRenderViewFactory();
9 | }
10 |
11 | @Override
12 | public IRenderView createRenderView(Context context) {
13 | return new TextureRenderView(context);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/player/src/main/java/xyz/doikki/videoplayer/util/L.java:
--------------------------------------------------------------------------------
1 | package xyz.doikki.videoplayer.util;
2 |
3 | import android.util.Log;
4 |
5 | import xyz.doikki.videoplayer.player.VideoViewManager;
6 |
7 | /**
8 | * 日志类
9 | * Created by Doikki on 2017/6/5.
10 | */
11 |
12 | public final class L {
13 |
14 | private L() {
15 | }
16 |
17 | private static final String TAG = "DKPlayer";
18 |
19 | private static boolean isDebug = VideoViewManager.getConfig().mIsEnableLog;
20 |
21 |
22 | public static void d(String msg) {
23 | if (isDebug) {
24 | Log.d(TAG, msg);
25 | }
26 | }
27 |
28 | public static void e(String msg) {
29 | if (isDebug) {
30 | Log.e(TAG, msg);
31 | }
32 | }
33 |
34 | public static void i(String msg) {
35 | if (isDebug) {
36 | Log.i(TAG, msg);
37 | }
38 | }
39 |
40 | public static void w(String msg) {
41 | if (isDebug) {
42 | Log.w(TAG, msg);
43 | }
44 | }
45 |
46 | public static void setDebug(boolean isDebug) {
47 | L.isDebug = isDebug;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/player/src/main/jniLibs/armeabi-v7a/libijkffmpeg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/q215613905/TVBoxOS/49e631437836a97cdf158544267de59855c11b6a/player/src/main/jniLibs/armeabi-v7a/libijkffmpeg.so
--------------------------------------------------------------------------------
/player/src/main/jniLibs/armeabi-v7a/libijksdl.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/q215613905/TVBoxOS/49e631437836a97cdf158544267de59855c11b6a/player/src/main/jniLibs/armeabi-v7a/libijksdl.so
--------------------------------------------------------------------------------
/player/src/main/jniLibs/armeabi-v7a/libp2p.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/q215613905/TVBoxOS/49e631437836a97cdf158544267de59855c11b6a/player/src/main/jniLibs/armeabi-v7a/libp2p.so
--------------------------------------------------------------------------------
/player/src/main/jniLibs/armeabi-v7a/libplayer.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/q215613905/TVBoxOS/49e631437836a97cdf158544267de59855c11b6a/player/src/main/jniLibs/armeabi-v7a/libplayer.so
--------------------------------------------------------------------------------
/player/src/main/jniLibs/armeabi-v7a/libxl_stat.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/q215613905/TVBoxOS/49e631437836a97cdf158544267de59855c11b6a/player/src/main/jniLibs/armeabi-v7a/libxl_stat.so
--------------------------------------------------------------------------------
/player/src/main/jniLibs/armeabi-v7a/libxl_thunder_sdk.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/q215613905/TVBoxOS/49e631437836a97cdf158544267de59855c11b6a/player/src/main/jniLibs/armeabi-v7a/libxl_thunder_sdk.so
--------------------------------------------------------------------------------
/player/src/main/res/layout/ijk_demo_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/player/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/player/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ijkPlayer
3 |
--------------------------------------------------------------------------------
/pyramid/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | id 'com.chaquo.python'
4 | }
5 |
6 | android {
7 | compileSdk 33
8 |
9 | defaultConfig {
10 | minSdkVersion 19
11 | targetSdkVersion 28
12 | ndk {
13 | //abiFilters 'arm64-v8a'
14 | //noinspection ChromeOsAbiSupport
15 | abiFilters "armeabi-v7a"
16 | }
17 | python {
18 | buildPython("D:/Programs/Python/Python38/python.exe")
19 | pip {
20 | install "lxml"
21 | install "ujson"
22 | install "pyquery"
23 | install "requests"
24 | install "jsonpath"
25 | install "cachetools"
26 | install 'pycryptodome'
27 | install 'beautifulsoup4'
28 | }
29 | }
30 | }
31 |
32 | buildTypes {
33 | all {
34 | ndk {
35 | //noinspection ChromeOsAbiSupport
36 | abiFilters 'armeabi-v7a'
37 | }
38 | }
39 | release {
40 | minifyEnabled false
41 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
42 | }
43 | }
44 | compileOptions {
45 | sourceCompatibility JavaVersion.VERSION_1_8
46 | targetCompatibility JavaVersion.VERSION_1_8
47 | }
48 |
49 | sourceSets {
50 | main{
51 | // Android代码模块
52 | setRoot "src/main"
53 | // Python代码模块,也就是你的Python源码所在项目中的文件夹
54 | python.srcDirs = ["src/python"]
55 | }
56 | }
57 | buildToolsVersion '30.0.3'
58 | }
59 |
60 | dependencies {
61 |
62 | }
--------------------------------------------------------------------------------
/pyramid/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/pyramid/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/pyramid/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/pyramid/src/python/base/localProxy.py:
--------------------------------------------------------------------------------
1 | class Proxy:
2 | def getUrl(self, local):
3 | return 'http://127.0.0.1:9978'
4 |
5 | def getPort(self):
6 | return 9978
--------------------------------------------------------------------------------
/pyramid/src/python/runner.py:
--------------------------------------------------------------------------------
1 | #coding=utf-8
2 | #!/usr/bin/python
3 | class Runner(): # 元类 默认的元类 type
4 | def __init__(self,spider):
5 | self.spider = spider
6 | def getDependence(self):
7 | return self.spider.getDependence()
8 | def getName(self):
9 | return self.spider.getName()
10 | def init(self,extend=""):
11 | self.spider.init(extend)
12 | def homeContent(self,filter):
13 | return self.spider.homeContent(filter)
14 | def homeVideoContent(self):
15 | return self.spider.homeVideoContent()
16 | def categoryContent(self,tid,pg,filter,extend):
17 | return self.spider.categoryContent(tid,pg,filter,extend)
18 | def detailContent(self,ids):
19 | return self.spider.detailContent(ids)
20 | def searchContent(self,key,quick):
21 | return self.spider.searchContent(key,quick)
22 | def playerContent(self,flag,id,vipFlags):
23 | return self.spider.playerContent(flag,id,vipFlags)
24 | def liveContent(self,url):
25 | return self.spider.liveContent(url)
26 | def localProxy(self,param):
27 | return self.spider.localProxy(param)
28 | def isVideoFormat(self,url):
29 | return self.spider.isVideoFormat(url)
30 | def manualVideoCheck(self):
31 | return self.spider.manualVideoCheck()
--------------------------------------------------------------------------------
/pyramid/src/python/trigger.py:
--------------------------------------------------------------------------------
1 | #coding=utf-8
2 | #!/usr/bin/python
3 | class Trigger(): # 元类 默认的元类 type
4 | @staticmethod
5 | def init(sp_obj,extend=""):
6 | sp_obj.init(extend)
7 | @staticmethod
8 | def homeContent(sp_obj,filter):
9 | return sp_obj.homeContent(filter)
10 | @staticmethod
11 | def homeVideoContent(sp_obj):
12 | return sp_obj.homeVideoContent()
13 | @staticmethod
14 | def categoryContent(sp_obj,tid,pg,filter,extend):
15 | return sp_obj.categoryContent(tid,pg,filter,extend)
16 | @staticmethod
17 | def detailContent(sp_obj,ids):
18 | return sp_obj.detailContent(ids)
19 | @staticmethod
20 | def searchContent(sp_obj,key,quick):
21 | return sp_obj.searchContent(key,quick)
22 | @staticmethod
23 | def playerContent(sp_obj,flag,id,vipFlags):
24 | return sp_obj.playerContent(flag,id,vipFlags)
25 | @staticmethod
26 | def liveContent(sp_obj,url):
27 | return sp_obj.liveContent(url)
28 | @staticmethod
29 | def isVideoFormat(sp_obj,url):
30 | return sp_obj.isVideoFormat(url)
31 | @staticmethod
32 | def manualVideoCheck(sp_obj):
33 | return sp_obj.manualVideoCheck()
--------------------------------------------------------------------------------
/quickjs/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 |
5 | android {
6 | compileSdkVersion 33
7 |
8 | defaultConfig {
9 | minSdkVersion 16
10 | targetSdkVersion 28
11 | externalNativeBuild {
12 | cmake {
13 | abiFilters 'armeabi-v7a'
14 | }
15 | }
16 | }
17 |
18 | buildTypes {
19 | all {
20 | ndk {
21 | abiFilters 'armeabi-v7a'
22 | }
23 | }
24 | release {
25 | minifyEnabled false
26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
27 | }
28 |
29 | debug {
30 | }
31 | }
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 | externalNativeBuild {
37 | /*cmake {
38 | path file('src/main/cpp/CMakeLists.txt')
39 | version "3.10.2"
40 | }*/
41 | }
42 | }
43 |
44 | dependencies {
45 | }
--------------------------------------------------------------------------------
/quickjs/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/quickjs/src/main/java/com/whl/quickjs/android/QuickJSLoader.java:
--------------------------------------------------------------------------------
1 | package com.whl.quickjs.android;
2 |
3 | public final class QuickJSLoader {
4 | public static void init() {
5 | init(Boolean.FALSE);
6 | }
7 |
8 | public static void init(Boolean bool) {
9 | try {
10 | System.loadLibrary("quickjs-android-wrapper");
11 | if (bool) {
12 | startRedirectingStdoutStderr("QuJs ==> ");
13 | }
14 | } catch (Throwable throwable) {
15 |
16 | }
17 | }
18 |
19 | public static native void startRedirectingStdoutStderr(String str);
20 | }
21 |
--------------------------------------------------------------------------------
/quickjs/src/main/java/com/whl/quickjs/wrapper/BindingContext.java:
--------------------------------------------------------------------------------
1 | package com.whl.quickjs.wrapper;
2 |
3 | import java.lang.reflect.Method;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | public class BindingContext {
8 |
9 | protected Map functionMap;
10 |
11 | protected Method contextSetter;
12 |
13 | public BindingContext() {
14 | functionMap = new HashMap<>();
15 | contextSetter = null;
16 | }
17 |
18 | public Map getFunctionMap() {
19 | return functionMap;
20 | }
21 |
22 |
23 | public Method getContextSetter() {
24 | return contextSetter;
25 | }
26 |
27 | public void setContextSetter(Method contextSetter) {
28 | this.contextSetter = contextSetter;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/quickjs/src/main/java/com/whl/quickjs/wrapper/ContextSetter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2023. caoccao.com Sam Cao
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.whl.quickjs.wrapper;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * The interface QuickJSContext setter.
27 | *
28 | * @since 0.8.1
29 | */
30 | @Documented
31 | @Target(ElementType.METHOD)
32 | @Retention(RetentionPolicy.RUNTIME)
33 | public @interface ContextSetter {
34 | }
35 |
--------------------------------------------------------------------------------
/quickjs/src/main/java/com/whl/quickjs/wrapper/Function.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2023. caoccao.com Sam Cao
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.whl.quickjs.wrapper;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * The annotation QUJS function is for auto-registering JS function interception.
27 | *
28 | * @since 0.8.1
29 | */
30 | @Documented
31 | @Target(ElementType.METHOD)
32 | @Retention(RetentionPolicy.RUNTIME)
33 | public @interface Function {
34 | /**
35 | * JS function name.
36 | *
37 | * @return the name of the JS function to be injected
38 | * @since 0.8.1
39 | */
40 | String name() default "";
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/quickjs/src/main/java/com/whl/quickjs/wrapper/JSCallFunction.java:
--------------------------------------------------------------------------------
1 | package com.whl.quickjs.wrapper;
2 |
3 | public interface JSCallFunction {
4 |
5 | Object call(Object... args);
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/quickjs/src/main/java/com/whl/quickjs/wrapper/JSFunction.java:
--------------------------------------------------------------------------------
1 | package com.whl.quickjs.wrapper;
2 |
3 | public class JSFunction extends JSObject {
4 |
5 | private final long objPointer;
6 |
7 | public JSFunction(QuickJSContext context, long objPointer, long pointer) {
8 | super(context, pointer);
9 | this.objPointer = objPointer;
10 | }
11 |
12 | public Object call(Object... args) {
13 | return getContext().call(this, objPointer, args);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/quickjs/src/main/java/com/whl/quickjs/wrapper/ModuleLoader.java:
--------------------------------------------------------------------------------
1 | package com.whl.quickjs.wrapper;
2 |
3 | /**
4 | * Created by Harlon Wang on 2023/8/26.
5 | */
6 | public abstract class ModuleLoader {
7 | /**
8 | * 模块加载模式:
9 | * True 会调用 {@link #getModuleBytecode(String)}
10 | * False 会调用 {@link #getModuleStringCode(String)}
11 | *
12 | * @return 是否字节码模式
13 | */
14 | public abstract boolean isBytecodeMode();
15 |
16 | /**
17 | * 获取字节码代码内容
18 | *
19 | * @param moduleName 模块路径名,例如 "xxx.js"
20 | * @return 代码内容
21 | */
22 | public abstract byte[] getModuleBytecode(String moduleName);
23 |
24 | /**
25 | * 获取字符串代码内容
26 | *
27 | * @param moduleName 模块路径名,例如 "xxx.js"
28 | * @return 代码内容
29 | */
30 | public abstract String getModuleStringCode(String moduleName);
31 |
32 | /**
33 | * 该方法返回结果会作为 moduleName 参数给到 {@link #getModuleBytecode(String)}
34 | * 或者 {@link #getModuleStringCode(String)} 中使用,默认返回 moduleName。
35 | * 一般可以在这里对模块名称进行转换处理。
36 | *
37 | * @param baseModuleName 使用 Import 的所在模块名称
38 | * @param moduleName 需要加载的模块名称
39 | * @return 模块名称
40 | */
41 | public String moduleNormalizeName(String baseModuleName, String moduleName) {
42 | return moduleName;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/quickjs/src/main/java/com/whl/quickjs/wrapper/QuickJSException.java:
--------------------------------------------------------------------------------
1 | package com.whl.quickjs.wrapper;
2 |
3 | /**
4 | * Created by Harlon Wang on 2022/2/8.
5 | */
6 | public class QuickJSException extends RuntimeException {
7 |
8 | private final boolean jsError;
9 |
10 | public QuickJSException(String message) {
11 | this(message, false);
12 | }
13 |
14 | public QuickJSException(String message, boolean jsError) {
15 | super(message);
16 | this.jsError = jsError;
17 | }
18 |
19 | public boolean isJSError() {
20 | return jsError;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/quickjs/src/main/jniLibs/armeabi-v7a/libquickjs-android-wrapper.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/q215613905/TVBoxOS/49e631437836a97cdf158544267de59855c11b6a/quickjs/src/main/jniLibs/armeabi-v7a/libquickjs-android-wrapper.so
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = "TVBox"
2 | include ':app'
3 | include ':player'
4 | include ':quickjs'
5 | include ':pyramid'
--------------------------------------------------------------------------------