giteshpatil opened a new issue #314:
URL: https://github.com/apache/cordova-plugin-media/issues/314
# Bug Report
On Android below 11 works fine and size also comes perfect but on android 11
size always comes as 0
## Problem
### What is expected to happen?
It should record the file and should be able to show file size more than 0
### What does actually happen?
Not working in android 11
## Information
<!-- Include all relevant information that might help understand and
reproduce the problem -->
Any more information needed please feel free to ask.
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
recordAudio(){
let extension ='wav' // 'm4a' 'mp3'
this.file.createFile(this.file.dataDirectory, '111file.'+extension,
true).then(() => {
this.myFile =
this.media.create(this.file.dataDirectory+'111file.'+extension,);
console.log('filepath',this.file.dataDirectory+'111file.'+extension)
console.log("this.myFile",this.myFile)
this.myFile.startRecord();
alert('started recording')
}).catch(err=>{
console.log('createFile err',err)
});
async stopRecording(){
let extension = 'wav'// 'm4a' 'mp3'
alert('stop called')
this.myFile.stopRecord()
setTimeout(() => {
let duration = this.myFile.getDuration();
console.log(duration);
console.log("this.myFile2",this.myFile)
this.file.readAsDataURL(this.file.dataDirectory,
'111file.'+extension).then(res=>{
console.log("checkFile res",res)
let url = this.file.dataDirectory+'111file.'+extension
this.file.resolveLocalFilesystemUrl(url).then(fileEntry => {
fileEntry.getMetadata((metadata) => {
console.log("size",metadata.size);//metadata.size is the size in bytes
})
})
}).catch(err=>{
console.log("checkFile err",err)
})
}, 1000);
}
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you
experiencing the issue? -->
Device used: Oneplus 9R
OS: Android 11
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
Project based on ionic 3
cordova 10.0.0
ionic 5.4.13
"cordova-plugin-file": "^6.0.2",
"cordova-android": "8.1.0",
"@ionic-native/media": "^4.20.0",
"cordova-plugin-media": "^5.0.3",
"typescript": "2.8.4"
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x ] I searched for existing GitHub issues
- [x ] I updated all Cordova tooling to most recent version
- [x ] I included all the necessary information above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]