I serve with code below a mp4 file:
import os
from starlette.responses import FileResponse
return FileResponse(
filename_out,
media_type="video/mp4",
filename=os.path.basename(filename_out)
)
In firefox, chrome and in android it works fine. Unfortunately it doesn't for the AVPlayer (used by the flutter video_player package) in IOS.
I found this thread iOS 10 AVPlayer will not stream video from URL with no extension and with video/mp4 as content type
However, the file extension is provided with the explicit filename and I'm confused about the header stuff. Has anybody similar experience and a solution?
Edit: In filename is e.g. video.mp4 after that with the test.client it looks like:
{'content-type': 'video/mp4', 'content-disposition': 'attachment; filename="video.mp4"',
'content-length': '5909110', 'last-modified': 'Mon, 10 Feb 2020 21:23:10 GMT', 'etag': 'd4be0ee89866a2fdc6e2c2dc94c4bc21'}
Attachment feels not right with/without it is a stream and works with common browser player and android but not in IOS. We use the flutter package video_player and _controller.value.initialized is always false with IOS, but true using a direct file from AWS not served by starlette:
_controller = VideoPlayerController.network('urlWithMp4StreamOrAttachment',);
Thanks in advance, Christian