Skip to content

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

@tongzhang-commit

Description

@tongzhang-commit

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)
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions