更新记录
2.0.0(2024-12-14)
1.添加安卓播放器 2.增加水印、播放错误处理 3.修改已知问题
1.0.0(2023-08-16)
阿里云播放器集成
平台兼容性
| Android | Android CPU类型 | iOS | 
|---|---|---|
| 适用版本区间:7.1 - 12.0 | armeabi-v7a:支持,arm64-v8a:支持,x86:未测试 | 适用版本区间:11 - 16 | 
原生插件通用使用流程:
- 购买插件,选择该插件绑定的项目。
 - 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
 - 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
 - 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
 - 开发完毕后正式云打包
 
付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios    
注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择
注意 需要去阿里云获取License和证书
第一步 布局 - 注意要在nvue中使用
<template>  
   <view>
     <why-video  ref="player" :style="{'width':width+'px','height':height+'px'}"></why-video>
   </view>
</template>
第二步 开始播放
onLoad() {
       //小屏的默认高度
            this.width = uni.upx2px(750)
            this.height = uni.upx2px(422)
            //导航蓝高度
            const sys = uni.getSystemInfoSync()
            this.navHeight = (sys.statusBarHeight + 44)
            //安卓监听播放器全屏
            if (uni.getSystemInfoSync().platform != "ios") {
                var globalEvent = uni.requireNativePlugin('globalEvent');
                globalEvent.addEventListener('onFullScreenToggle', (e) => {
                    this.isFull = e.isFullScreen
                    if (e.isFullScreen) {
                        this.width = sys.screenHeight
                        this.height = sys.screenWidth
                        // this.marginBottom = 0
                    } else {
                        this.width = uni.upx2px(750)
                        this.height = uni.upx2px(422)
                        // this.marginBottom = 30
                    }
                });
            }
},
mounted() {
     //导航和状态栏高度 - 全屏时候需要
      const sys = uni.getSystemInfoSync()
      const navHeight= sys.statusBarHeight + 44
      this.$nextTick(() => {
           //开始播放
            this.$refs.player?.play({
               'src': '视频地址', //支持常见的FLV、HLS、MP4、MP3等点播场景的音视频格式。
                'title': '视频标题',
                'current': 0, //可选字段 - 没有默认开始播放时间可以不传
                'navHeight': this.navHeight,
                'canDrag': true //可选字段 - 是否显示控制组件
                'waterMark':'水印'//可选
            })
      })
}
第三步 暂停和继续播放 - 非必要
暂停播放 
this.$refs.player?.pause()
继续播放
this.$refs.player?.resume()
第四步 释放
onUnload() {
    this.$refs.player?.destroy()
}
                                        
                                                                    
                                                                        收藏人数:
                                    
                                                        购买(
                                                                                                                试用
                                                    
                                        赞赏(0)
                                    
                                            
                                            
 下载 68
                
 赞赏 0
                
            
                    下载 12289 
                
            
            
            
            
            
            
            
            
            
            
                        赞赏 7 
                    
            
            
            
            
                        
                                赞赏
                            
            
京公网安备:11010802035340号