Re: Video files not streaming on mobile devices - ZMS only

"Sebastian Tänzer [email protected] [zms-developers]" <[email protected]> Wed, 11 Nov 2015 17:34:09 +0100
Newsgroups gmane.comp.cms.zms.devel
Message-ID <[email protected]>
--Apple-Mail=_7F73F534-3940-4941-9ACE-6BBCD97205E2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hello Robert,

you=E2=80=99re right, that=E2=80=99s what happens. We already found out and=
 are working on a solution to implement the HTTP Range header here.

Best,
Sebastian

> Am 11.11.2015 um 17:10 schrieb Robert Buchholz [email protected] [zm=
s-developers] <[email protected]>:
>=20
> Hallo,
>=20
> I don't think ZMS's file serving code handles the HTTP "Range" header,
> which is required by iOS to stream videos:
> https://developer.apple.com/library/prerelease/ios/documentation/AppleApp=
lications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/Creatin=
gVideoforSafarioniPhone.html#//apple_ref/doc/uid/TP40006514-SW6
>=20
>=20
> Best,
>=20
> Robert
>=20
>=20
>=20
> On 09.11.2015 13:21, Sebastian T=C3=A4nzer [email protected] [zms-developers]=
 wrote:
>> Hi Hiels,
>>=20
>> thanks a lot. From what I see this is related to the FileFromData functi=
on that is used to created blob fields programmatically. We=E2=80=99re not =
doing that. In our case the user simply uploads a video file in a file fiel=
d, nothing else. Storing is handled by ZMS just fine. The file does not com=
e from the ZODB, definitely not. The file is in the mediadb folder in the s=
ystem and returned from there (deleting the file physically in the folder a=
ctually causes an error)
>>=20
>> The problem we=E2=80=99re experiencing seems to be related to the way ZM=
S handles HTTP reponses of this data as there is a special HTTP =E2=80=9Est=
ream=E2=80=9C method in the native OFS.File source.
>>=20
>> Our headers we set by our python script to return the video are _exactly=
_ the same.
>>=20
>> I=E2=80=99ll play a bit more with this and will post my insights :-)
>>=20
>> Best
>> Sebastian
>>=20
>>> Am 09.11.2015 um 13:16 schrieb Niels Dettenbach [email protected] [zms-de=
velopers] <[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 o=
f this itself
>>>> when using getData() on a file field?
>>>=20
>>> If i remember right, i had to change this method to get a generated fil=
e from a special db into the mediadb (when required):
>>>=20
>>>   # -------------------------------------------------------------------=
-------
>>>   #  ZMSGlobals.FileFromData:
>>>   # -------------------------------------------------------------------=
-------
>>>   def FileFromData( self, data, filename=3D'', content_type=3DNone, med=
iadbStorable=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 Z=
ODB instead of a configured mediadb. If i remember right, with Images / Ima=
ge 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 wo=
rk
>>>> with video files - any other files work just fine. The files themselve=
s 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 fro=
m 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 rem=
ember right, i had to fiddle with the correct Headers a while. So may be th=
is 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=
 gone to the frontend proxy, so this may be incomplete or lines are comment=
ed 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'%fil=
ename)
>>>=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
>>=20
>=20
>=20
> --
> Mit freundlichen Gr=C3=BC=C3=9Fen
> Robert Buchholz
> -----------------------------------------------------------
> yeepa Software Engineering
> mailto:[email protected]
> -----------------------------------------------------------
> yeepa is a registered trademark of
> SNTL Publishing GmbH & Co KG
> Hegelplatz 1, 10117 BERLIN
> T: ++49-(0)30 - 209 127 8-4
> F: ++49-(0)30 - 209 127 8-1
> www.sntl-publishing.com
> [email protected]
> -----------------------------------------------------------
>=20


--Apple-Mail=_7F73F534-3940-4941-9ACE-6BBCD97205E2
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

iQIcBAEBCgAGBQJWQ24BAAoJELhf/PDHS9TweX4P/RkmyMangGV2mpuSjbqxCO+5
pG88TeHVpxEAiZnGC62Dysxni9EJgK5Rrfz0ZI6+EsagE7TQzFTFo75Kkfi942mj
JpocjU3wYh4j07sghZc1VqngvzPhPd8oRoXFNfqVtKcIKiB91TaB5QVO8E7DTTro
OzSM7MvmOAY5MBNwU0Ntc/t1j0gUhJO6i8fheoSso+zTApM6EeJ1IneWNtUsmWew
Yw0kJ1I4gxoD0S2c4aQibEu5LVngzKwX2Le2RcD1GSC1y65hktU079eJL+1hULJI
U3TX65Q/ESVZO1jNTT9uPp1arobWDyeZpZCCD5xYO8wlEKWs6q/IGrk5LVCfBdxc
lrYHmJrSspPTnyQT2x4bO/OqXBfuEcmjeDbvvedIasrGZOcgOcPxF4Gc/JPJIrqR
xKoxy2iN1FuMEKMLQso9TwLIWBkZUQwNgMEPN8q9f+UzVt9eezjc09nZJMLEzJsZ
ku/THwuHikepSVHxQdpz9TRF2WsD3nvxD+KSH5Mm39/sRGy2ReObpQDTttjChGjI
tJx/dG9gvGvHJw5bhAW73pXEGEc/iYjkMgE49QYs2EIOfPZMfZ7sIsBB9AHj51Sf
WWGr6/x23NHKKWWkIW0qMwCHJPiapM+917tUUVCmGoNsIeDQtWkd+5DTuMfZfORU
fh2RriAWJij+12GLJBl5
=BGEa
-----END PGP SIGNATURE-----

--Apple-Mail=_7F73F534-3940-4941-9ACE-6BBCD97205E2--