海豚星空扫码投屏 Android 接收端 SDK 集成 六步骤

扫码投屏,开放网络,独占设备,不需要额外下载软件,微信扫码,发现设备。支持标准DLNA协议,支持倍速播放。视频,音频,图片投屏。好点意思。还支持自定义基于 DLNA 扩展的操作动作。好像要收费,没体验。

这里简单记录一下集成过程。

一 跟目录的build.gradle添加私有mevan仓库

maven {url 'http://nexus.dolphinstar.cn/repo/openmavenx'}   

二 app/build.gradle

2.1 添加依赖

implementation 'cn.dolphinstar:playerCore:3.0.20'

2.2 开启JAVA8支持

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

三 权限

    
    
    
    
    
    
    
    
    
    
    
      

四 网络

注意 android 9后强制https,为了支持http。应在AndroidManifest.xml的Application节点添加

android:networkSecurityConfig="@xml/network_security_config"

network_security_config.xml



    

五 申请AppId

前往 海豚星空平台 控制中心 注册并创建应用获取appId

在app/src/main/assets
添加文件dpsAppInfo
添加建值对
APPID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

六 启动服务

//启动配置
StartUpCfg cfg = new StartUpCfg();
cfg.PlayerName = "MY TV-" +(int) (Math.random() * 900 + 100);
cfg.AppSecret = ""; //APP的Secret
//启动服务
MYOUPlayer.of(MainActivity.this)
    .StartService(cfg)
    .subscribe(s -> {
       //投屏服务启动成功
       Log.e("MainActivity","投屏服务启动成功");
    }, e -> {
       //投屏服务启动失败
        Log.e("MainActivity","投屏服务启动失败:"+ e.getMessage());
    });

完成!!!

你可能感兴趣的:(海豚星空扫码投屏 Android 接收端 SDK 集成 六步骤)