I'm trying to play a video that is served by a Flask web application on my iOS application. While I can play any video served with a "conventional" web server (like Apache), I can't play the video served by Flask. Here is the relevant code:
Objective-C
NSURL *videoURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@",videourltemp]];
AVPlayer *player = [AVPlayer playerWithURL:videoURL];
playerViewController.player = player;
[self.view addSubview:playerViewController.view];
[self.navigationController pushViewController:playerViewController animated:YES];
Python
from flask import Response, ...
def get_img(imgid):
# private code hidden - file["path"] contains the path relative to /root/media_assets directory
return Response(open("/root/media_assets/" + file["path"], "rb"), mimetype="video/mp4")
Sidenote: if I try to reach my URL from a browser, the video is correctly loaded.
How could I solve my problem?
Thank you in advance!