Back to Gsyvideoplayer

托管方式

doc/DEPENDENCIES.md

13.2.110.0 KB
Original Source

托管方式

Click to see the English version

目前有三种托管方式:

  • MavenCentral : 11.0.0 版本以后才有,所有基类包都发布托管在这里
  • Github Package : 9.1.0 版本开始才有, 但是 11.0.0 之前, GSYIjkJava 的基础依赖还是在托管在 jitpack
  • Jitpack IO :依然会发布,但是存在托管平台随机丢包

1、mavenCentral 引用(推荐)

由于 jitpack 不断丢包,目前已迁移至 MavenCentral,使用方式如下:

First 添加

groovy
allprojects {
    repositories {
        ///...
        mavenCentral()
        maven { url "https://maven.aliyun.com/repository/public" }
    }
}

你可以选择下面三种的其中一种,在module下的build.gradle添加。

A、直接引入

groovy
 //完整版引入

implementation 'io.github.carguo:gsyvideoplayer:13.2.1'


//是否需要AliPlayer模式
implementation 'io.github.carguo:gsyvideoplayer-aliplay:13.2.1'

B、添加java和你想要的so支持:

groovy
 implementation 'io.github.carguo:gsyvideoplayer-java:13.2.1'

 //是否需要ExoPlayer模式
 implementation 'io.github.carguo:gsyvideoplayer-exo2:13.2.1'

 //可选直接依赖;exo2 已经通过 api 传递 RTMP 模块
 implementation 'io.github.carguo:gsyvideoplayer-rtmp:13.2.1'

 //可选投屏实现;不投屏不要添加(该模块真实 minSdk 为 26)
 implementation 'io.github.carguo:gsyvideoplayer-cast:13.2.1'

 //是否需要AliPlayer模式
 implementation 'io.github.carguo:gsyvideoplayer-aliplay:13.2.1'

 //根据你的需求ijk模式的so
 implementation 'io.github.carguo:gsyvideoplayer-arm64:13.2.1'
 implementation 'io.github.carguo:gsyvideoplayer-armv7a:13.2.1'
 implementation 'io.github.carguo:gsyvideoplayer-armv5:13.2.1'
 implementation 'io.github.carguo:gsyvideoplayer-x86:13.2.1'
 implementation 'io.github.carguo:gsyvideoplayer-x64:13.2.1'

C、支持其他格式协议的(mpeg,rtsp, concat、crypto协议,支持 16k Page Size)

A、B普通版本支持263/264/265等,对于mpeg编码会有声音无画面情况。 C 引入的so支持mpeg编码和其他补充协议,但是so包相对变大。

groovy
 implementation 'io.github.carguo:gsyvideoplayer-java:13.2.1'

 //是否需要ExoPlayer模式
 implementation 'io.github.carguo:gsyvideoplayer-exo2:13.2.1'

 //是否需要AliPlayer模式
 implementation 'io.github.carguo:gsyvideoplayer-aliplay:13.2.1'

 //更多ijk的编码支持
 implementation 'io.github.carguo:gsyvideoplayer-ex_so:13.2.1'

D、Jetpack Compose 支持(可选)

groovy
 implementation 'io.github.carguo:gsyvideoplayer-compose:13.2.1'

gsyvideoplayer-compose 依赖 gsyvideoplayer-java,如果需要 ExoPlayer / AliPlayer / 指定 IJK so,仍按上面的方式额外引入对应模块。

2、Github Package 依赖方式(推荐)

由于 Jitpack 经常存在历史包随机丢失问题,所以新增 Github Package 依赖方式,使用方式如下

不过 github package 访问需要 token 去 access 比较麻烦,但是胜在稳定

groovy
allprojects {
    repositories {
		//...
        maven {
            url 'https://maven.pkg.github.com/CarGuo/GSYVideoPlayer'

            // You can also use your own GitHub account and token
            // For convenience, I have provided a token for an infrequently used account here
            credentials {
                // your github name
                username = 'carsmallguo'
                // your github generate new token
                password = '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'
            }
        }
        maven {
            url "https://maven.aliyun.com/repository/public"
        }
        mavenCentral()
    }
}

理论上就是右上角头像 - Settings - Developer Settings - Personal access tokens - tokens (classic) - Generate new token(classic)- read:packages 记得过期时间选择永久

你可以选择下面三种的其中一种,在module下的build.gradle添加。

A、直接引入

groovy
 //完整版引入
 implementation 'com.shuyu:gsyvideoplayer:13.2.1'


 //是否需要AliPlayer模式
 implementation 'com.shuyu:gsyvideoplayer-aliplay:13.2.1'

B、添加java和你想要的so支持:

groovy
 implementation 'com.shuyu:gsyvideoplayer-java:13.2.1'

 //是否需要ExoPlayer模式
 implementation 'com.shuyu:gsyvideoplayer-exo2:13.2.1'

 //可选直接依赖;exo2 已经通过 api 传递 RTMP 模块
 implementation 'com.shuyu:gsyvideoplayer-rtmp:13.2.1'

 //可选投屏实现;不投屏不要添加(该模块真实 minSdk 为 26)
 implementation 'com.shuyu:gsyvideoplayer-cast:13.2.1'

 //是否需要AliPlayer模式
 implementation 'com.shuyu:gsyvideoplayer-aliplay:13.2.1'

 //根据你的需求ijk模式的so
 implementation 'com.shuyu:gsyvideoplayer-armv5:13.2.1'
 implementation 'com.shuyu:gsyvideoplayer-armv7a:13.2.1'
 implementation 'com.shuyu:gsyvideoplayer-arm64:13.2.1'
 implementation 'com.shuyu:gsyvideoplayer-x86:13.2.1'
 implementation 'com.shuyu:gsyvideoplayer-x64:13.2.1'

C、支持其他格式协议的(mpeg,rtsp, concat、crypto协议,支持 16k Page Size)

A、B普通版本支持263/264/265等,对于mpeg编码会有声音无画面情况。 C 引入的so支持mpeg编码和其他补充协议,但是so包相对变大。

groovy
 implementation 'com.shuyu:gsyvideoplayer-java:13.2.1'

 //是否需要ExoPlayer模式
 implementation 'com.shuyu:gsyvideoplayer-exo2:13.2.1'


 //是否需要AliPlayer模式
 implementation 'com.shuyu:gsyvideoplayer-aliplay:13.2.1'

 //更多ijk的编码支持
 implementation 'com.shuyu:gsyvideoplayer-ex_so:13.2.1'

D、Jetpack Compose 支持(可选)

groovy
 implementation 'com.shuyu:gsyvideoplayer-compose:13.2.1'

3、Jitpack 引入方法(会继续发布,但不是很推荐)

历史包可能会出现随机丢包,而且还不好补充,可见 #4144

First、在project下的build.gradle添加

groovy
allprojects {
    repositories {
		//...
        maven { url 'https://jitpack.io' }
        maven { url "https://maven.aliyun.com/repository/public" }
        mavenCentral()
    }
}

你可以选择下面三种的其中一种,在module下的build.gradle添加。

A、直接引入

groovy
 //完整版引入

 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer:v13.2.1'


 //是否需要AliPlayer模式
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-aliplay:v13.2.1'

B、添加java和你想要的so支持:

groovy
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-java:v13.2.1'

 //是否需要ExoPlayer模式
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-exo2:v13.2.1'

 //可选投屏实现;不投屏不要添加(该模块真实 minSdk 为 26)
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-cast:v13.2.1'

 //是否需要AliPlayer模式
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-aliplay:v13.2.1'

 //根据你的需求ijk模式的so
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-arm64:v13.2.1'
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-armv7a:v13.2.1'
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-armv5:v13.2.1'
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-x86:v13.2.1'
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-x64:v13.2.1'

C、支持其他格式协议的(mpeg,rtsp, concat、crypto协议,支持 16k Page Size)

A、B普通版本支持263/264/265等,对于mpeg编码会有声音无画面情况。 C 引入的so支持mpeg编码和其他补充协议,但是so包相对变大。

groovy
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-java:v13.2.1'

 //是否需要ExoPlayer模式
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-exo2:v13.2.1'

 //是否需要AliPlayer模式
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-aliplay:v13.2.1'

 //更多ijk的编码支持
 implementation 'com.github.CarGuo.GSYVideoPlayer:gsyvideoplayer-ex_so:v13.2.1'

投屏(DLNA/UPnP)依赖

从 13.2.1 起,协议无关的 CastCapability / CastProvider / CastSession SPI 保留在 gsyvideoplayer-java,jUPnP/Jetty 和默认 DLNA 实现迁入独立发布的 gsyvideoplayer-cast。默认播放器依赖不再传递 jUPnP/Jetty。

依赖坐标(Maven Central):

groovy
dependencies {
    implementation 'io.github.carguo:gsyvideoplayer:13.2.1'
    implementation 'io.github.carguo:gsyvideoplayer-cast:13.2.1'
}

不需要再手动声明 jUPnP 或 Jetty;gsyvideoplayer-cast 的 POM 会统一传递兼容版本。

注意事项:

  • 最低版本:默认 gsyvideoplayer 受 Media3 1.10.1 约束,最低为 API 23;显式添加投屏 module 后,Jetty 9.4.53 将真实下限提高到 API 26。
  • 网络权限:接收端和发送端需要 INTERNETACCESS_WIFI_STATECHANGE_WIFI_MULTICAST_STATEACCESS_NETWORK_STATE。同一 Wi-Fi 局域网内 SSDP 才能发现设备。
  • Android 独立进程:Demo 的 Loopback Receiver 在独立 :dlna 进程,避免 jUPnP static 状态污染主进程;下游自集成时可参考 DevReceiverService
  • Android 13+ 需要给内部广播加 RECEIVER_NOT_EXPORTED,参考 CastReceiverManager
  • 悬浮窗接收端需要 SYSTEM_ALERT_WINDOW 权限,正式集成建议改成 ActivitySurface 呈现,不必沿用悬浮窗。
  • 不需要投屏就不要引入 gsyvideoplayer-cast;核心 SPI 仍可用于接入其他投屏 Provider。

更多能力目标与测试判据见 CAST_FEATURE_PLAN.mdCAST_TEST_PLAYBOOK.md