Re: Video files not streaming on mobile devices - ZMS only
"Niels Dettenbach [email protected] [zms-developers]" <[email protected]> Mon, 09 Nov 2015 13:16:55 +0100
| Newsgroups | gmane.comp.cms.zms.devel |
|---|---|
| Organization | Syndicat IT&Internet |
| Message-ID | <2273757.N98sP1hcmk@gongo> |
--nextPart13045849.V5c1VQHycL
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
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 t=
his itself
> when using getData() on a file field?
If i remember right, i had to change this method to get a generated file fr=
om a special db into the mediadb (when required):
# ---------------------------------------------------------------------=
-----
# ZMSGlobals.FileFromData:
# ---------------------------------------------------------------------=
-----
def FileFromData( self, data, filename=3D'', content_type=3DNone, media=
dbStorable=3DFalse):
before:
def FileFromData( self, data, filename=3D'', content_type=3DNone ):
otherwise each generated file from a onChangeObject is landing in the ZODB =
instead of a configured mediadb. If i remember right, with Images / Image b=
lobs this was working out of the box instead.
>=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 d=
o
> 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 t=
he mediadb.
>
...just out of my work,=20
this works here so far for MP3s in a web player and in iTunes. If i remembe=
r right, i had to fiddle with the correct Headers a while. So may be this c=
ould bring you on a way it works for you (hope so)...
Cleaned out a bit from stuff not relevant here. Some of the headers are gon=
e to the frontend proxy, so this may be incomplete or lines are commented o=
ut. No guarantees so far!!!
request =3D container.REQUEST
RESPONSE =3D request.RESPONSE
session =3D context.REQUEST.SESSION
RESPONSE =3D request.RESPONSE
counted =3D False
try:
if context.getObjProperty('audiofile_playout',request):
file=3Dcontext.getObjProperty('audiofile_playout',request)
else:
file=3Dcontext.getObjProperty('audiofile',request)
#filetype=3Dfile.getContentType()
filetype=3D"audio/mpeg"
filename=3Dfile.getFilename()
filesize=3Dfile.getDataSizeStr()
fileurl=3Dfile.getHref(request)
# rise in object request counters
try:
# count on the ad
# -> remember last played/requested url
context.countMP3Requested()
# generates cookie / session if required
#if not session.get('last_played_id'):
# session.set('last_played_id','no')
counted =3D True
except:
counted =3D False
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'%filen=
ame)
return file.getData()
except:
RESPONSE.setStatus('404')
return 'Error: File not found'
good luck,
Niels.
--=20
---
Niels Dettenbach
Syndicat IT & Internet
http://www.syndicat.com
PGP: https://syndicat.com/pub_key.asc
---
=20
--nextPart13045849.V5c1VQHycL
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCgAGBQJWQI63AAoJEA27WohFkipEIdIP/jp8cPGg/VTkLAXJ7GUcdsLP
hShdSXpEY0iwXlc3rb2q9L+lGjzKpTRLbgfIsz3ksUJy0Sf4w+oCC+3FQ7YecAnN
duNbvi6ZL7HmEyV154vhqDH6O5Bm5zkm/Nt/amRSlE6nGC2J0aZgQWNkrAhuVohn
5r2DOWiKPlQgNh+yym+XfUfakxdkHYNWTj5VNxQWgiw5/p0yltIXjr1vApB/oti4
ab3bnvCFxdV395tE0zYXm94sxOUvaLdhVbblz4klOrerR5h331/+JRd5vkxr+y0K
iQjfZBeKOvmDaJyRZLhsErNC0IfATMm+Mo2mIM4IEBi1vcXikCh6kRuj63ANqXL7
ptku9t9IK7Dh463bTsD/aG7Sgdo/LMsOlyQlJWgcg7dSinzM73E//T+GffN81Yof
ieHLtL5iF3fOmmVM08IfKnGOkCpBUMpZfus63SS3iJl15rNe4rtgasqeGxwQXEne
7hBX+t3YG7+oEKYWOrSinn308MYlryT3ZYfki/hSnVPzflkJcEl3qIFhovadCfTY
NIKw25fpPlPM3QjWtoVPY7KvdfZua4XjAREHW1lr30fJzRZyJXfonAKyNwufg+Ct
hx8tlpK+pVs7S3ogD5fYIwlqH/u6P4apBOtTbl3H/QXJ0+XrWpmS/iclyckTGLFO
s8pY0Uw+mEu3Q4AkuhUy
=6ztk
-----END PGP SIGNATURE-----
--nextPart13045849.V5c1VQHycL--