Single PHP “exit;” statement prevents HTML5 video in Safari

前端 未结 3 1158
独厮守ぢ
独厮守ぢ 2021-01-19 09:16

Bizarre bug: in a PHP script that serves video files, I have a few test conditions (authenticate token, make sure file exists, etc.) before sending a \"video/mp4\" header an

3条回答
  •  爱一瞬间的悲伤
    2021-01-19 09:59

    It turns out that browsers make two requests to a source before playing it. I was only seeing the headers for the first requests, hence my confusion. The reason the video played in Chrome but not Safari is because the agent that makes the 2nd request in Safari ("QuickTime/7.6.6 (qtver=7.6.6;cpu=IA32;os=Mac 10.6.4)") apparently can't read the same $_COOKIEs; whereas with Chrome, the $_COOKIEs are intact across both requests.

    I still have a serious problem, in that the video plays only on desktop browsers, and not on the iPhone. I'm sure it's not an encoding problem, because if I access the MP4 directly, it plays fine; the problem occurs only when the video is outputted through PHP. Anyway, that's another question altogether.

提交回复
热议问题