移动直播SDK文档地址
TXLiveBase.getInstance().setLicence(this, licenceURL, licenceKey);
推流配置文档操作
// 配置 TXLivePushConfig mLivePushConfig = new TXLivePushConfig();TXLivePusher mLivePusher = new TXLivePusher(this); mLivePusher.setConfig(mLivePushConfig);// mPusherView 是 SDK 定义的控件mLivePusher.startCameraPreview(mPusherView);// 启动推流 mLivePusher.startPusher(rtmpURL.trim());// 结束推流 mLivePusher.stopPusher();mLivePusher.stopCameraPreview(true);
mLivePlayer = new TXLivePlayer(mContext);mPlayConfig = new TXLivePlayConfig(); // mPlayerView 是 SDK 定义的控件 mLivePlayer.setPlayerView(mPlayerView); mLivePlayer.setConfig(mPlayConfig); // 开始播放mLivePlayer.startPlay(flvUrl, TXLivePlayer.PLAY_TYPE_LIVE_FLV);// 结束播放mLivePlayer.stopPlay(true); mPlayerView.onDestroy();
mLivePlayer.switchStream("new_stream_url");
// 设置是否自动调整缓存时间mPlayConfig.setAutoAdjustCacheTime(true); // 设置最小缓存时间 mPlayConfig.setMinAutoAdjustCacheTime(1);// 设置最大缓存时间 mPlayConfig.setMaxAutoAdjustCacheTime(5);