|
[插件使用]
播放视频使用TCSuperPlayer在ios端黑屏不显示但是有声音
[复制链接]
不知道怎么回事能帮忙看看嘛~~!
// 引入腾讯超级播放器模块
this.data.TCSuperPlayer = api.require('TCSuperPlayer');
// 初始化
this.data.TCSuperPlayer.initPlayer();
// 配置播放器视图
this.data.TCSuperPlayer.configPlayerView({
rect: {
x: 0,
y: 0,
w: api.winWidth,
h: 250
},
fixedOn: 'video',
fixed: true, // 必须是true,否则不能触发全屏
isShowDanmu: false, // 全屏状态下是否显示弹幕开关按钮,仅Android支持
isShowSnapshot: false, // 全屏状态下是否显示截屏按钮
isShowMoreButton: true, // 全屏状态下是否显示更多按钮
isShowPipBtn: false, // 描述:(可选项)非全屏状态下是否显示画中画按钮,仅支持iOS端
isShowWindowLayoutTop: true, // 半屏状态下是否显示播放区域顶部导航条
isShowBackBtn: true, // 半屏状态下是否显示播放区域顶部返回按钮,返回按钮在顶部导航条内的布局中
});
console.log('封面图:' + this.data.poster)
this.data.TCSuperPlayer.playWithUrl({
title: this.data.currentVideoInfo.video_title,
videoURL: this.data.currentVideoInfo.path,
})
this.data.TCSuperPlayer.addPlayerListener(function (ret) {
console.log(JSON.stringify(ret))
if (ret.eventType == 'fullScreenChanged') {
this.data.is_full = !this.data.is_full;
console.log('是否全屏:' + JSON.stringify(this.data.is_full));
if (this.data.is_full) {
api.setScreenOrientation({ orientation: "landscape_left" }); // 设置横屏
// 设置进入全屏
api.setFullScreen({
fullScreen: true
});
this.data.video_height = api.winWidth; // 把屏幕宽度赋值给视频的高度
console.log(this.data.video_height + 'this.data.video_height');
this.data.safe_top = 0; // 安全区域设置为0px
} else {
api.setScreenOrientation({ orientation: "portrait_up" }); //竖屏时,屏幕在home键的上面
this.data.safe_top = api.safeArea.top; // 设置区域
this.data.video_height = 250; // 设置视频高度
}
} else if (ret.eventType == 'back') { // 触发返回事件
if (this.data.winHeight == api.winHeight) {
// 竖屏,调用返回上一页函数
this.back();
}
}
}.bind(this));
|
|