Skip to content

CTY-Library/cordova-plugin-document-picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

文件选择插件

参考

cordova-plugin-camera

使用案例

uploadVideo(){

this.mediaType = this.camera.MediaType.VIDEO;

this.currentType = 'VIDEO';

CDVDocumentPicker.getFile( (url) => { alert(url);

  

    if(url.indexOf("file:///")>= 0){

       url = url.substr(8, url.length - 8);//去掉 file:///

    }

    let fileName = this.generateFileName('.mp4');

  AppAliYunOSS.uploadFile(this.memberApi, 'teamvideo', fileName, url, (objectName) => {

    this.onSuccess(objectName , fileName); //objectName为阿里上的地址

     
  }, (err) => {

    alert('错误1:'+JSON.stringify(err));      

  });



}, (error) => { alert(error) },"SAVEDPHOTOALBUM",['video/*',"doc"],"",true);

}

uploadDocument(){

this.mediaType = this.camera.MediaType.VIDEO;

this.currentType = 'VIDEO';

CDVDocumentPicker.getFile( (url) => { 

  url = decodeURIComponent(url); //转码

  alert(url);
  
  if(this.Util.isIOS){
  
    if(url.indexOf("file:///")>= 0){
    
       url = url.substr(8, url.length - 8);//去掉 file:///
       
    }
    
    let fileName = this.generateFileName('.mp4');
    
  AppAliYunOSS.uploadFile(this.memberApi, 'teamvideo', fileName, url, (objectName) => {
  
    this.onSuccess(objectName , fileName); //objectName为阿里上的地址
    
     
  }, (err) => {
  
    alert('错误1:'+JSON.stringify(err));    
    
  });
  
  }
  
}, (error) => { alert(error) },"DOCUMENT",['*/*'],"");

}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published