You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CaptureVideo(): Promise<File>{returnnew Promise<File>((resolve,reject)=>{constoptions: CaptureVideoOptions={limit: 1,duration: 120,// Seconds};this.mediaCapture.captureVideo(options).then(async(mediaData: MediaFile[])=>{console.log(`File size: ${mediaData[0].size/1000000} MB`);mediaData[0].getFormatData((mediaFormatData: MediaFileData)=>{console.log(mediaFormatData);constorientation=this.getOrientation(mediaFormatData);console.log(orientation);if(this.platform.is("ios")){constfile='file://'+mediaData[0].fullPath;this.file.resolveLocalFilesystemUrl(file).then((entry: FileEntry)=>{entry.file((entryContext)=>{// webkitRelativePath is a read-only non standard property// https://developer.mozilla.org/en-US/docs/Web/API/File/webkitRelativePath// @ts-ignoreresolve(entryContext);});}).catch((entryErr: Error)=>{console.log(mediaData[0].fullPath);console.log("[IOS] Error while reading file.",entryErr.message);reject();});}elseif(this.platform.is("android")){this.file.resolveLocalFilesystemUrl(mediaData[0].fullPath).then((entry: FileEntry)=>{entry.file((entryCntx)=>{// webkitRelativePath is a read-only non standard property// https://developer.mozilla.org/en-US/docs/Web/API/File/webkitRelativePath// @ts-ignoreresolve(entryCntx);});}).catch((readVideoErr)=>{console.log("Error while reading file.",readVideoErr);reject();});}},(err)=>{console.log("Error getting media format.",err);reject();});},(captureVideoErr)=>{if(captureVideoErr.message!=='Canceled.'){// Handle errorconsole.log("Error while taking video.",captureVideoErr);}reject();});});}
Work around using another plugin for others coming across this issue. In combination with this plug in, use cordova-plugin-video-editor and use their GetVideoInfo() function to provide accurate orientation with out extra logic, regardless of platform.
Here is an example using Ionic's types in an angular app.
Bug Report
Problem
MediaFile.getFormatData() displays the same width/height regardless of video capture orientation on iOS.
What is expected to happen?
Expected to get the videos dimensions so I can figure out the orientation the video was captured in.
What does actually happen?
Calling MediaFile.getFormatData() always gives this object:
Information
Using this to get the media orientation
Command or Code
Environment, Platform, Device
Ionic, Cordova IOS 6.0.2, iPhone XR, iOS 14.4.1
Version information
Checklist
The text was updated successfully, but these errors were encountered: