类 TsPlayer.Builder

    • 构造器详细资料

      • Builder

        public Builder​(@NonNull
                       Context context,
                       @NonNull
                       CacheProxyFactory cacheProxyFactory)
        播放器构造Builder
        参数:
        context - Context
        cacheProxyFactory - CacheProxyFactory,如需改变默认缓存配置策略,或者使用自定义缓存代理,可实现此Factory
      • Builder

        public Builder​(@NonNull
                       Context context,
                       @Nullable
                       LifecycleOwner lifecycleOwner,
                       @NonNull
                       CacheProxyFactory cacheProxyFactory)
        播放器构造Builder
        参数:
        context - Context
        lifecycleOwner - LifecycleOwner 非必选,可为 null,暂时无用
        cacheProxyFactory - CacheProxyFactory,如需改变默认缓存配置策略,或者使用自定义缓存代理,可实现此Factory
    • 方法详细资料

      • setLooper

        public TsPlayer.Builder setLooper​(@Nullable
                                          Looper looper)
        设置player播放事件的回调所在的 Looper

        Note: 如果未设置,默认使用调用线程的Looper,如果调用线程的Looper为空, 则使用主线程的Looper,意味着播放器事件将在主线程回调

        参数:
        looper - Looper
        返回:
        TsPlayer.Builder
      • setCacheProxyFactory

        public TsPlayer.Builder setCacheProxyFactory​(@NonNull
                                                     CacheProxyFactory cacheProxyFactory)
        自己制定缓存代理
        参数:
        cacheProxyFactory - CacheProxyFactory,如需改变默认缓存配置策略,或者使用自定义缓存代理,可实现此Factory
        返回:
        TsPlayer.Builder
      • build

        @AnyThread
        public TsPlayer build()
        构建播放器
        优先级:
        1. 如果有集成 engine-exo module 则会使用ExoPlayer
        2. 如果无 engine-exo module,而有engine-ijk module则会使用IjkPlayer
        返回:
        TsPlayer