private void shareToTv() { Toast.makeText(mContext, "开始连接电视中", Toast.LENGTH_SHORT).show(); showProgressView(true); DLNAContainer.getInstance().setSelectedDevice(mDevices.get(0)); mSelectDevice = DLNAContainer.getInstance().getSelectedDevice(); setController(new MultiPointController()); if (mController == null || DLNAContainer.getInstance().getSelectedDevice() == null) { Toast.makeText(mContext, "数据异常", Toast.LENGTH_SHORT).show(); return; } playVideoOnTv(mNowPlayVideo.getPlayUrl().getFormatUrl()); }
/** 显示推送视频播放控制页面 */ private void showDLNAController() { String name = DLNAContainer.getInstance().getSelectedDevice().getFriendlyName(); String title = mContext .getResources() .getString(R.string.dlna_device_title, TextUtils.isEmpty(name) ? "您的电视" : name); mDLNARootLayout.setVisibility(VISIBLE); ((TextView) mDLNARootLayout.findViewById(R.id.txt_dlna_title)).setText(title); }
/** 检测DLNA信息,如果有支持的设备,显示按钮 */ private void initDLNAInfo() { mDevices = DLNAContainer.getInstance().getDevices(); setController(new MultiPointController()); setDLNAButton(mDevices.size() > 0); }