uni-app 5+api 读取视频文件转成base64 核心代码

  //#ifdef APP-PLUS
                                                                                            
                                                          
                                                                                            
                                           const path = plus.io.convertLocalFileSystemURL(that.faceDetectInfo.spPhoto) //绝对路径
                                             const fileReader = new plus.io.FileReader()
                                                                                                               
                                                                                                               
                                           fileReader.readAsDataURL(path)
                                           fileReader.onloadend = (res) => { //读取文件成功完成的回调函数
                                                               // console.log(res.target.result) //输出base64内容
                                                                                                                   
                                               that.faceDetectInfo.base64 = res.target.result.split(",")[1];  //去掉base64前缀
                                                                                                                   
                                                                                                                  
                                                                                                                   

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章