Player_Android icon indicating copy to clipboard operation
Player_Android copied to clipboard

uniapp安卓原生uts插件中无法渲染播放器 com.tencent.liteav:LiteAVSDK_Player:12.5.0.17567

Open tongzhang-commit opened this issue 6 months ago • 0 comments

import VideoView from "android.widget.VideoView" import View from "android.view.View"; import ViewGroup from "android.view.ViewGroup"; import FrameLayout from "android.widget.FrameLayout"; import LayoutParams from "android.widget.FrameLayout.LayoutParams"; import TXVodPlayer from "com.tencent.rtmp.TXVodPlayer"; import TXVodPlayConfig from "com.tencent.rtmp.TXVodPlayConfig"; import TXCloudVideoView from "com.tencent.rtmp.ui.TXCloudVideoView";

// 设置播放器视图 setupPlayerView(container: UniNativeViewElement): void { try { const videoView = new VideoView(container.getAndroidActivity()!); // buttonText.setText('这是原生Video')

	// 创建 TXCloudVideoView 作为播放器视图(在uniappx中 编写UTs安卓插件无法渲染和显示)
	const playerView2 = new TXCloudVideoView(container.getAndroidActivity()!);

	container.bindAndroidView(playerView2);
	// 将 TXCloudVideoView 设置给播放器
	this.txVodPlayer?.setPlayerView(playerView2);
} catch (error) {
	console.log(error)
}

}

tongzhang-commit avatar May 29 '25 09:05 tongzhang-commit