我正在使用Alloy(钛SDK:7.5.0,iOS SDK:12.1,Xcode版本:10.1)和Axway Appcelerator开发iOS应用。我想在Titanium.Media.VideoPlayer中可视化.mp4文件,该文件位于运行Flask和flask-socketio的工作站中。由于Titanium的VideoPlayer想要文件的远程URL来播放它,所以我用Flask的脚本编写:
@app.route('/<vid_name>')
def serve_video(vid_name):
vid_path = os.path.join('/home/myFolder', vid_name)
resp = make_response(send_file(vid_path, 'video/mp4'))
resp.headers['Content-Disposition'] = 'inline'
return resp
但是当VideoPlayer尝试使用其URL访问.mp4文件时,我从Flask收到此错误:
IP - - [21/Feb/2019 17:10:58] "GET /myVid.mp4 HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('IP', 51600)
Traceback (most recent call last):
File "/home/myUser/miniconda2/envs/T2/lib/python2.7/SocketServer.py", line 596, in process_request_thread
self.finish_request(request, client_address)
File "/home/myUser/miniconda2/envs/T2/lib/python2.7/SocketServer.py", line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/myUser/miniconda2/envs/T2/lib/python2.7/SocketServer.py", line 654, in __init__
self.finish()
File "/home/myUser/miniconda2/envs/T2/lib/python2.7/SocketServer.py", line 713, in finish
self.wfile.close()
File "/home/myUser/miniconda2/envs/T2/lib/python2.7/socket.py", line 283, in close
self.flush()
File "/home/myUser/miniconda2/envs/T2/lib/python2.7/socket.py", line 307, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
我做错了什么?如何使用URL访问.mp4文件并在Titanium.Media.VideoPlayer中可视化?