I'm trying to get around a cross domain issue by proxying files from a java server to the web app. This works fine in most cases, but in iOS the video won't run.
It runs if the video comes straight from Amazon S3, but if I try and run it from a local server I get the 'media_err_src_not_supported' Error.
I'm assuming its to do with headers. I'm returning the files as such:
String filename = URLDecoder.decode(f, "UTF-8");
File file = new File("resources/files/", filename);
response.setHeader("Content-Type", "video/mp4");
response.setHeader("Content-Length", String.valueOf(file.length()));
response.setHeader("Content-Disposition", "inline; filename=\"" + file.getName() + "\"");
Files.copy(file.toPath(), response.getOutputStream());
And trying various ways of getting the video file into the video element i.e.
video.src = "/file/1.mp4";
or
video = document.createElement( 'video' );
source = document.createElement('source');
video.appendChild(source);
source.setAttribute('src',"/file/1.mp4");
source.setAttribute('type',"video/mp4");
Video is encoded in FFMPEG as such
ffmpeg -i out.mp4 -vcodec libx264 -profile:v baseline -preset slow -pix_fmt yuv420p -b:v 5000k -maxrate 5000k -bufsize 2200k -s 1920:1080 -threads 0 -b:a 128k -movflags faststart out2K.mp4
And will play it if comes from S3, just not from my server.
EDIT
I've made some progress using this MP4 plays when accessed directly, but not when read through PHP, on iOS
The error is the same in the browser, but the server reports it's sending the files the browser is requesting
34959 [qtp1121453612-40] INFO co.beek.pano.service.restService.MultipartFileSender - Return full file
35022 [qtp1121453612-37] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (15535447)
47812 [qtp1121453612-38] INFO co.beek.pano.service.restService.MultipartFileSender - Return full file
47971 [qtp1121453612-40] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (1)
47991 [qtp1121453612-39] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (16232853)
48380 [qtp1121453612-40] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (552544) to (16232853)
72467 [qtp1121453612-40] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (1)
72478 [qtp1121453612-39] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (15535447)
74094 [qtp1121453612-39] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (1)
74159 [qtp1121453612-51] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (15535447)
156335 [qtp1121453612-40] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (1)
156349 [qtp1121453612-57] INFO co.beek.pano.service.restService.MultipartFileSender - Return 1 part of file : from (0) to (15535447)