Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D237010037 for ; Mon, 22 Dec 2014 15:29:13 +0000 (UTC) Received: (qmail 48824 invoked by uid 500); 22 Dec 2014 15:29:13 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 48800 invoked by uid 500); 22 Dec 2014 15:29:13 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 48789 invoked by uid 99); 22 Dec 2014 15:29:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Dec 2014 15:29:13 +0000 Date: Mon, 22 Dec 2014 15:29:13 +0000 (UTC) From: "Ian Clelland (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-8103) file method on local file returns mime type "video/3gpp" for .mp4 files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-8103?page=3Dcom.atlassian.ji= ra.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1425583= 1#comment-14255831 ]=20 Ian Clelland commented on CB-8103: ---------------------------------- The mime type of the file doesn't depend on the filename at all -- they sho= uld be completely separate things. Cordova uses [{{android.content.ContentResolver.getType}}|http://developer.= android.com/reference/android/content/ContentResolver.html#getType(android.= net.Uri)] to determine the type of the file, which should be correct, accor= ding to its actual contents. (However, 3GPP and MP4 are both extensions of the same spec (MPEG-4 part 12= ) and may actually be compatible in some cases, regardless of the extension= or the detected mime type.) > file method on local file returns mime type "video/3gpp" for .mp4 files > ----------------------------------------------------------------------- > > Key: CB-8103 > URL: https://issues.apache.org/jira/browse/CB-8103 > Project: Apache Cordova > Issue Type: Bug > Components: Android, Plugin File > Affects Versions: 3.6.3 > Reporter: W. Matthew Wilson > > I have a feature in my app where a user can pick a video from their galle= ry and then upload it to a remote server. > I need the mime type of the file because right now, I can only process .m= p4 files, not .3gp files. > I'm using something like this code: > {code} > window.resolveLocalFileSystemURL( > local_video_path, // something like "/media/external/video/media/971" > function (f) { > console.debug("inside resolveLocalFileSystemURL callback", f); > f.file(function (fo) { > console.debug("fo", fo); > if (fo.size > 30 * 1000 * 1000) { > navigator.notification.alert("Sorry, that file is too big= ! Pick one less than 30 mb."); > } else if (fo.type =3D=3D "video/3gpp") { > navigator.notification.alert("Sorry, that file is a .3gp = file and we can't handle those!"); > } else { > // handle file... > } > }); > {code} > And when I pick a file that ends with .mp4, in the file(...) function cal= lback the mime type is set to 3gpp: > {code} > inside resolveLocalFileSystemURL callback=20 > FileEntry {isFile: true, isDirectory: false, name: "971", fullPath: "/med= ia/external/video/media/971", filesystem: FileSystem=E2=80=A6} > filesystem: FileSystem > fullPath: "/media/external/video/media/971" > isDirectory: false > isFile: true > name: "971" > nativeURL: "file:///storage/emulated/0/DCIM/Camera/20141117_122122.mp4" > __proto__: utils.extend.F > phonegapsend.js:818 > fo=20 > File {name: "content", localURL: "content://media/external/video/media/97= 1", type: "video/3gpp", lastModified: 1416244890, lastModifiedDate: 1416244= 890=E2=80=A6} > end: 16515092 > lastModified: 1416244890 > lastModifiedDate: 1416244890 > localURL: "content://media/external/video/media/971" > name: "content" > size: 16515092 > start: 0 > type: "video/3gpp" > __proto__: Object > {code} > That's not a very pretty example, but I do resolveLocalFileSystem on a fi= le "/media/external/video/media/971", and the native URL for that file is "= file:///storage/emulated/0/DCIM/Camera/20141117_122122.mp4". > Then I use the file(...) method to look up the size and the type of that = file, I get told that the type is "video/3gpp". That doesn't make sense to= me! > Am I doing something wrong or is this a bug? > Let me know if there is more information I should provide. > Go PhoneGap! -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org