帖子
帖子
用户
博客
课程
显示全部楼层
27
帖子
0
勋章
245
Y币

[插件使用] 播放视频使用TCSuperPlayer在ios端黑屏不显示但是有声音

[复制链接]
发表于 2023-5-23 09:25:59
不知道怎么回事能帮忙看看嘛~~!


// 引入腾讯超级播放器模块
        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));


12
帖子
0
勋章
6711
Y币
对,我也遇到了一样的情况
您好,安卓是可以正常播放吧
12
帖子
0
勋章
6711
Y币
安卓正常播放,ios出现黑屏
27
帖子
0
勋章
245
Y币
技术咨询-特特 · 2023-5-23 11:11您好,安卓是可以正常播放吧

安卓可以 ios黑屏
接口调用顺序:licence,configPlayerView,init,play,
如下代码:

var aliLivePlayer = api.require('TCSuperPlayer');
        aliLivePlayer.setLicence({
          licenceURL:'******e.license',
          licenceKey:'********'
        })
        aliLivePlayer.configPlayerView({
            rect: {
                x:0,
                y:20,
                w:375,
                h:280
            },
            isShowDanmu:false,
            isShowSnapshot:false,
            isShowMoreButton:false,
            isShowPipBtn:false,
            isShowBackBtn:false,
            isShowWindowLayoutTop:true
        });
        aliLivePlayer.initPlayer();
        aliLivePlayer.playWithUrl({
            dynamicWaterConfig:{
                tipText:'动态水印',
               tipTextSize:30,
               tipTextColor:'#ff0000'
            },
            title:'挖呀挖呀挖!',
            videoURL:'http://af1fb2ef33ba36ebbfad.qiniucdn.apicloud**.**/apicloud/1b99aa5822f858abd1da8b2bb8332055.MP4'
        });
接口调用顺序:setlicense config init play
27
帖子
0
勋章
245
Y币
iOS模块技术支持-Turbo · 2023-5-23 17:14接口调用顺序:setlicense config init play

谢谢ios已经可以展示出来了
12
帖子
0
勋章
6711
Y币
iOS模块技术支持-Turbo · 2023-5-23 17:14接口调用顺序:setlicense config init play

这个播放器在后台还会自动播放
您需要登录后才可以回帖 登录

本版积分规则