chat girldetail 图集制作
This commit is contained in:
@@ -289,8 +289,8 @@ export class SDKManager { //extends Component
|
||||
|
||||
|
||||
//region 播放背景视频 cbMap = {cbReady, cbEnded}
|
||||
static PlayBgAudio(remoteUrl:string, vtype:VideoRoleType, loop:boolean = false, extra:any = {}) {
|
||||
this.sdk.playBgAudio(remoteUrl, vtype, loop, extra);
|
||||
static PlayBgAudio(remoteUrl:string, loop:boolean = false, extra:any = {}) {
|
||||
this.sdk.playBgAudio(remoteUrl, loop, extra);
|
||||
}
|
||||
//添加要播放的表情视频
|
||||
static AddEmoAudio(remoteUrl:string, vtype:VideoRoleType, loop:boolean = false, extra:any = {}) {
|
||||
|
||||
@@ -643,17 +643,16 @@ export class WXSDK {
|
||||
private curPlayType: VideoRoleType = VideoRoleType.None; //当前播放的视频的类型
|
||||
playBgAudio(
|
||||
remoteUrl: string,
|
||||
vtype: VideoRoleType,
|
||||
loop: boolean = false,
|
||||
extra: any = {}
|
||||
) {
|
||||
if (this._bgVideo && this._bgShow) {
|
||||
this.playBgAudioNext(remoteUrl, vtype, loop, extra);
|
||||
this.playBgAudioNext(remoteUrl, loop, extra);
|
||||
return;
|
||||
}
|
||||
let self = this;
|
||||
console.log("微信 播放背景视频组件1", remoteUrl);
|
||||
this.curPlayType = vtype;
|
||||
//this.curPlayType = vtype;
|
||||
if (!this._bgVideo) {
|
||||
this._bgVideo = this.createVideoHandle();
|
||||
// this._bgVideo.onPlay(() => {
|
||||
@@ -694,13 +693,11 @@ export class WXSDK {
|
||||
private _bgTempShow: boolean = false;
|
||||
playBgAudioNext(
|
||||
remoteUrl: string,
|
||||
vtype: VideoRoleType,
|
||||
loop: boolean = false,
|
||||
extra: any = {}
|
||||
) {
|
||||
this.removeBgAudioNext();
|
||||
console.log("微信 创建背景视频组件2--->", remoteUrl);
|
||||
this.curPlayType = vtype;
|
||||
let self = this;
|
||||
if (!this._bgTempVideo) {
|
||||
this._bgTempVideo = this.createVideoHandle();
|
||||
|
||||
@@ -47,7 +47,9 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
openUIDataCT(data: any): void {
|
||||
this._data = data;
|
||||
}
|
||||
|
||||
getVideoClone() {
|
||||
return this.videoPlayer;
|
||||
}
|
||||
/**初始化视频事件监听 */
|
||||
private initVideoEvents() {
|
||||
if (!this.videoPlayer) return;
|
||||
@@ -111,7 +113,7 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
this.pendingVideoConfig = {
|
||||
size: config.size,
|
||||
position: config.position,
|
||||
scale: options?.scale
|
||||
scale: options?.scale,
|
||||
};
|
||||
|
||||
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
|
||||
@@ -199,13 +201,13 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
if (this.isPlaying && this.videoPlayer.isPlaying) {
|
||||
this.applyVideoConfiguration({
|
||||
size: targetSize,
|
||||
position: position
|
||||
position: position,
|
||||
});
|
||||
} else {
|
||||
// 如果视频还未准备好,存储配置等待应用
|
||||
this.pendingVideoConfig = {
|
||||
size: targetSize,
|
||||
position: position
|
||||
position: position,
|
||||
};
|
||||
console.log("SceneBgVideoLayer: 视频未准备好,配置已存储等待应用");
|
||||
}
|
||||
@@ -246,17 +248,21 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
targetWorldPos = new Vec3(pos.x, pos.y, pos.z || 0);
|
||||
}
|
||||
this.videoPlayer.node.setWorldPosition(targetWorldPos);
|
||||
console.log(`SceneBgVideoLayer: 设置视频位置 (${targetWorldPos.x}, ${targetWorldPos.y}, ${targetWorldPos.z})`);
|
||||
console.log(
|
||||
`SceneBgVideoLayer: 设置视频位置 (${targetWorldPos.x}, ${targetWorldPos.y}, ${targetWorldPos.z})`
|
||||
);
|
||||
}
|
||||
|
||||
// 应用尺寸和缩放设置
|
||||
if (config.size) {
|
||||
// 获取视频的原始尺寸(此时应该是准确的)
|
||||
const videoSize = uiTransform.contentSize;
|
||||
|
||||
|
||||
if (videoSize.width > 0 && videoSize.height > 0) {
|
||||
const targetWidth = config.size instanceof Size ? config.size.width : config.size.width;
|
||||
const targetHeight = config.size instanceof Size ? config.size.height : config.size.height;
|
||||
const targetWidth =
|
||||
config.size instanceof Size ? config.size.width : config.size.width;
|
||||
const targetHeight =
|
||||
config.size instanceof Size ? config.size.height : config.size.height;
|
||||
|
||||
// 计算缩放比例(填满整个区域)
|
||||
const scaleX = targetWidth / videoSize.width;
|
||||
@@ -264,7 +270,9 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
const scale = Math.max(scaleX, scaleY);
|
||||
|
||||
this.videoPlayer.node.setScale(new Vec3(scale, scale, 1));
|
||||
console.log(`SceneBgVideoLayer: 设置视频缩放 ${scale} (原始尺寸: ${videoSize.width}x${videoSize.height}, 目标尺寸: ${targetWidth}x${targetHeight})`);
|
||||
console.log(
|
||||
`SceneBgVideoLayer: 设置视频缩放 ${scale} (原始尺寸: ${videoSize.width}x${videoSize.height}, 目标尺寸: ${targetWidth}x${targetHeight})`
|
||||
);
|
||||
} else {
|
||||
console.warn("SceneBgVideoLayer: 无法获取视频尺寸,跳过缩放设置");
|
||||
}
|
||||
@@ -275,7 +283,9 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
console.log(`SceneBgVideoLayer: 设置显式缩放 ${config.scale}`);
|
||||
} else {
|
||||
this.videoPlayer.node.setScale(config.scale);
|
||||
console.log(`SceneBgVideoLayer: 设置显式缩放 (${config.scale.x}, ${config.scale.y}, ${config.scale.z})`);
|
||||
console.log(
|
||||
`SceneBgVideoLayer: 设置显式缩放 (${config.scale.x}, ${config.scale.y}, ${config.scale.z})`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// 没有指定尺寸或缩放,保持原始缩放
|
||||
@@ -288,14 +298,14 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
|
||||
private onVideoReadyToPlay = () => {
|
||||
console.log("SceneBgVideoLayer: 视频准备完成");
|
||||
|
||||
|
||||
// 应用待处理的视频配置
|
||||
if (this.pendingVideoConfig) {
|
||||
this.applyVideoConfiguration(this.pendingVideoConfig);
|
||||
// 清空待处理配置
|
||||
this.pendingVideoConfig = null;
|
||||
}
|
||||
|
||||
|
||||
this.onVideoReady();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user