Opened 13 years ago
Closed 13 years ago
#429 closed defect (fixed)
Videos/muisc don't play because MediaGoblin should take care of mime-type before upload them to Rackspace Cloudfiles
Reported by: | Jorge Araya Navarro | Owned by: | Jorge Araya Navarro |
---|---|---|---|
Priority: | critical | Milestone: | 0.3.0 |
Component: | component1 | Keywords: | video, mime, type, vpx, webm, rackspace, cloudfiles |
Cc: | jorgean@… | Parent Tickets: |
Description
This bug happen with some web browser which can't guess the mime type of a video and therefore, play such video. Rackspace by default set the mime type to application/octet-stream. I got a example code here:
conn = cloudfiles.get_connection(‘RACKCLOUD_USERNAME’, ‘RACKCLOUD_API_KEY’) container = self.conn.get_container(‘container_name’) meta_data = {} video_object = container.create_object(‘remote_video_name.mp4′) video_object.load_from_filename(‘/path/to/local/video.mp4′) meta_data['mime-type'] = ‘video/mp4′ video_object.metadata = meta_data video_object.sync_metadata()
Attachments (1)
Change History (8)
comment:1 by , 13 years ago
Priority: | major → critical |
---|
comment:2 by , 13 years ago
comment:3 by , 13 years ago
The mimetypes
python module looks in the following places for extension => MIMEtype mappings: http://hg.python.org/cpython/file/2.7/Lib/mimetypes.py#l40.
15/22:44.13 < joar> Shackra: Does any of these contain a .webm entry? http://hg.python.org/cpython/file/2.7/Lib/mimetypes.py#l40 15/22:44.44 * Shackra checks 15/22:45.53 < Shackra> CHET! 15/22:46.00 < Shackra> joar, no, it doesn't
comment:5 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Thanks for the patch! Please don't close a bug until your code is merged though, or else it will appear that it already has been, and then it might *never* get merged! :)
by , 13 years ago
Attachment: | bugfix429.patch added |
---|
the final patch for this annoying bug. It's a glorious victory, comrades!
comment:6 by , 13 years ago
and Boom Goes the Dynamite
I fix it, so, we can play video and audio files with any browser on Mediagoblin ;D
...
I though that until I patched my instance, because the bug still there in my public instance however my local-for-hacking instance works as expected, just watch this screenshot from my rackspace cloudfiles control panel
comment:7 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This patch got merged actually :)
So there's two ways to handle this.
Solution one way is a (comparitively) super easy, super lazy approach, which doesn't require any sort of rearchitecting whatsoever. That is, when we create a cloudfiles object, we check against some database that matches file extensions to known mimetypes. Python comes with one of these, but it's not complete, I think, for some recent things like webm. Anyway, see the following:
http://docs.python.org/library/mimetypes.html
I think there's a version we can add things to, but I haven't tested it. Look at:
http://docs.python.org/library/mimetypes.html#mimetypes-objects
This is potentially unideal because it means we might say audio files are 'video/webm' since all .webm files can only look like only *one* of video/webm or audio/webm under this method... however, that's "just as bad" as the way nginx handles it currently, which is to check the extension (so all .webms look like video/webm) and that's "good enough" for that, so maybe it's good enough for this too.
... So the second solution, which is a lot more messy, is to add something to our storage system so we can do something like:
That way we can set it ourself, *if we can*. I'm not really thrilled with that route though as it requires a lot of careful rearchitecting, so in retrospect, don't do it ;)
Solution 1 is probably best for now.