Guest User

Untitled

a guest
Jan 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. this.file.createDir(this.file.dataDirectory, 'mydir',true).then(_ =>{
  2. console.log('Directory exists ');
  3. this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => {
  4. console.log('Directory exists when checked');
  5. this.camera.getPicture(options).then(videoData=>{
  6. console.log(videoData)
  7. let date=new Date().toISOString().slice(0,10);
  8. let H=new Date().getHours();
  9. let M=new Date().getMinutes();
  10. let S=new Date().getSeconds();
  11.  
  12. this.filename =date+H+M+S;
  13. this.videoEditor.transcodeVideo({
  14. fileUri: videoData,
  15. outputFileName: this.filename,
  16. outputFileType: 0
  17. }).then((fileUri: string) =>{ console.log('video transcode success===>', fileUri);
  18. this.videoEditor.trim({
  19. fileUri:videoData,
  20. trimStart:0,
  21. trimEnd:30,
  22. outputFileName:'trim'+this.filename}).then(trimmedData=>{
  23. this.videoEditor.getVideoInfo({fileUri:videoData}).then(info=>{
  24. if(info.duration>=30){alert('Video length Greater than 30 s')}
  25.  
  26. else if(info.size>=30000000){
  27. alert('This video size is greater than 30Mb')
  28. }
  29.  
  30. console.log(JSON.stringify(info));
  31. }).catch((error:any)=>console.log('video info gathering error after video trimmed'+error));
  32.  
  33. console.log(JSON.stringify(trimmedData));
  34. }).catch((error:any)=>console.log('video trim error'+error));
  35.  
  36. this.videoEditor.getVideoInfo({fileUri:videoData}).then(info=>{
  37. if(info.duration>=30){alert('Video length Greater than 30 s')}
  38.  
  39. else if(info.size>=30000000){
  40. alert('This video size is greater than 30Mb')
  41. }
  42.  
  43. console.log(JSON.stringify(info));
  44. }).catch((error:any)=>console.log('video info gathering error'+error));
  45.  
  46. }).catch((error: any) => console.log('video transcode error', error));
  47. })
  48.  
  49.  
  50. // }).catch(err => console.log(err));
  51.  
  52. }).catch(err => console.log('Directory doesnt exist'));
  53. }).catch(err => console.log('Directory error===>'+err));
Add Comment
Please, Sign In to add comment