Midiman7472
Midiman7472

Reputation: 45

mp4 video not playing only on ipad using HTML5 video

We experience an issue with playing a mp4 file on ipad on webpage with a video HTML 5 player.

Issue: It does not work on ipad/iphone. On all other platforms (Windows,Android, iOS desktop) it works fine.

This is the code:

<video id="my-video"  width="400" height="240" preload="true"  controls >
<source src="/media/video/6d9ab49-9936-4194-acvb-3cd9b60521fg/myvideo.mp4" />
</video>

Connected the ipad to the Mac to debug: A message 'requested resource cannot be found'. Does sound very clear but does not make sense because the mp4 file is accessible when you paste the url into the browser address bar.

Already tested and checked:

So I guess the issue really is that the mp4 can not be found or loaded on ipad. But why? Hope someone can help.

Upvotes: 1

Views: 2683

Answers (2)

Bernard Chew
Bernard Chew

Reputation: 1

I had this very same problem serving videos on my Liferay Portal, which works perfectly on PC and Android, but not on iOS devices. After numerous tests, I think I've finally managed to nail down the cause.

For some reason, if the video file (eg MP4) is accessible by a guest user (ie accessible without having to log on to the server), then it will work fine on iOS. However, if the file is only accessible to logged on users, it won't work.

My theory on why this happens is that iOS is probably using a different session to do the range request check than the one used to play the video file. Thus, the range request check fails because the file is inaccessible.

Upvotes: 0

herrsiim
herrsiim

Reputation: 147

Have you tried it like this, include src directly inside <video> tag?

<video id="my-video" src="/media/video/6d9ab49-9936-4194-acvb-3cd9b60521fg/myvideo.mp4" width="400" height="240" preload="true" controls></video>

If it still doesn't work try to use only video element with src, remove preload and controls. Just to see if you can get it to work. And if still no results, try to go for absolute src path.

Upvotes: 0

Related Questions