Re: Video files not streaming on mobile devices - ZMS only
"Sebastian Tänzer [email protected] [zms-developers]" <[email protected]> Mon, 9 Nov 2015 13:21:14 +0100
| Newsgroups | gmane.comp.cms.zms.devel |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_3C3403D6-AFFE-4CDE-A3F8-ED6073D2C9E6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Hiels, thanks a lot. From what I see this is related to the FileFromData function = that is used to created blob fields programmatically. We=E2=80=99re not doi= ng that. In our case the user simply uploads a video file in a file field, = nothing else. Storing is handled by ZMS just fine. The file does not come f= rom the ZODB, definitely not. The file is in the mediadb folder in the syst= em and returned from there (deleting the file physically in the folder actu= ally causes an error) The problem we=E2=80=99re experiencing seems to be related to the way ZMS h= andles HTTP reponses of this data as there is a special HTTP =E2=80=9Estrea= m=E2=80=9C method in the native OFS.File source. Our headers we set by our python script to return the video are _exactly_ t= he same. I=E2=80=99ll play a bit more with this and will post my insights :-) Best Sebastian > Am 09.11.2015 um 13:16 schrieb Niels Dettenbach [email protected] [zms-deve= lopers] <[email protected]>: >=20 > Am Montag, 9. November 2015, 12:55:52 schrieben Sie: >> Hey Niels, >>=20 >> thanks for the quick reply. We are in fact using mediadb and from what I= see >> the files do come from the filesystem. Doesn=E2=80=99t ZMS take care of = this itself >> when using getData() on a file field? >=20 > If i remember right, i had to change this method to get a generated file = from a special db into the mediadb (when required): >=20 > # --------------------------------------------------------------------= ------ > # ZMSGlobals.FileFromData: > # --------------------------------------------------------------------= ------ > def FileFromData( self, data, filename=3D'', content_type=3DNone, medi= adbStorable=3DFalse): >=20 > before: >=20 > def FileFromData( self, data, filename=3D'', content_type=3DNone ): >=20 > otherwise each generated file from a onChangeObject is landing in the ZOD= B instead of a configured mediadb. If i remember right, with Images / Image= blobs this was working out of the box instead. >=20 >>=20 >> My problem is that the data return from the mediadb by ZMS does not work >> with video files - any other files work just fine. The files themselves = do >> not reside in the ZODB but in the filesystem. >>=20 >> I=E2=80=99d love to see your code snippet to read the actualy file from = the mediadb. >>=20 >=20 > ...just out of my work, > this works here so far for MP3s in a web player and in iTunes. If i remem= ber right, i had to fiddle with the correct Headers a while. So may be this= could bring you on a way it works for you (hope so)... >=20 > Cleaned out a bit from stuff not relevant here. Some of the headers are g= one to the frontend proxy, so this may be incomplete or lines are commented= out. No guarantees so far!!! >=20 > request =3D container.REQUEST > RESPONSE =3D request.RESPONSE > session =3D context.REQUEST.SESSION >=20 > RESPONSE =3D request.RESPONSE > counted =3D False >=20 > try: > if context.getObjProperty('audiofile_playout',request): > file=3Dcontext.getObjProperty('audiofile_playout',request) > else: > file=3Dcontext.getObjProperty('audiofile',request) >=20 > #filetype=3Dfile.getContentType() > filetype=3D"audio/mpeg" > filename=3Dfile.getFilename() > filesize=3Dfile.getDataSizeStr() > fileurl=3Dfile.getHref(request) >=20 > # rise in object request counters > try: > # count on the ad > # -> remember last played/requested url > context.countMP3Requested() >=20 > # generates cookie / session if required > #if not session.get('last_played_id'): > # session.set('last_played_id','no') >=20 > counted =3D True > except: > counted =3D False >=20 > RESPONSE.setStatus('200') > #RESPONSE.setHeader('Cache-Control', 'no-cache') > RESPONSE.setHeader('Content-Type', filetype) > RESPONSE.setHeader('Content-Length', filesize) > RESPONSE.setHeader('Content-Disposition','attachment;filename=3D%s'%file= name) >=20 > return file.getData() >=20 > except: > RESPONSE.setStatus('404') > return 'Error: File not found' >=20 >=20 > good luck, >=20 >=20 > Niels. >=20 > -- > --- > Niels Dettenbach > Syndicat IT & Internet > http://www.syndicat.com > PGP: https://syndicat.com/pub_key.asc > --- >=20 >=20 >=20 >=20 --Apple-Mail=_3C3403D6-AFFE-4CDE-A3F8-ED6073D2C9E6 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJWQI+6AAoJELhf/PDHS9TwHAQQALksS9bTMQqKT9MTdI4lZK2R SK4/dMAxFyS6tQfPYgd6AiitYYOEABLomMlR7AOZSYl+dkBfeEh2kapgzgD0n5Kp mECPOHJXPrZpfPIogma7zrvvUyBv/DxbPRUZqtwbZmfsC5b6LWSsBF5emwe36tL1 OfKd9Rq3eglQEaMhESjQR7F9tFXSirebmCYW4SgS87PyZ+DjVI38LDHyv4X38/OX E3jiH5RzJI5a9uW/0ZO6S3RMGu8PPUuvISVP6ysdNdmJY8zwmI2BtIh5MqRk6EyT hv9zp1tFothGoOFM/j83ntHdtyv0jI2uaL9ZbKcCKNad4NJhEag//xxc0Yk6C17B nE/BOFm6ZFtdqLgb1YWZvZU8NOy0QhWABOGUU/9lHzzJfwZ7n+6jaHSQpf3fI9gY dmFRzA60cpDHAB8q6siM4nDchUcCBgv8kBY0qjjCJeaK8UuwlcZck4/TLUCZnsgX N644BK+A9GM75tuKmTNAozDpiCfFxrI1UeJUtu4HuRXZ5mf5DJHEx7fWsJyQvwfo szSM1F8NN1zn2aag5d2f1s7eJtTmWvF7bpY8Tz6M2OEMJbCJTVUxGyyk4ceUJ7g3 rw0OKofWhDQUkAr82VHjMdzZQm8waa/Z+kNcR94A4v0PYgRGoojaOZtnnCFPEv73 nn++lja4QowVFZ2mn+Tw =CK9h -----END PGP SIGNATURE----- --Apple-Mail=_3C3403D6-AFFE-4CDE-A3F8-ED6073D2C9E6--