我想在模板中播放mp3文件,但音频未正确加载。音频开始播放,但我无法向前或向后移动。当我不使用django并使用简单的HTML时,它工作正常。
我使用mediaelement.js作为库但我认为它不是库问题,因为当我使用简单的音频标签加载文件时会出现同样的错误。
我正在使用媒体网址链接提供我的文件但是当我将测试音频文件放在静态文件夹中时出现了同样的问题。
每当我转到链接时(/播放列表被路由到只显示模板的视图)。我在shell中看到以下错误......
System check identified no issues (0 silenced).
July 09, 2017 - 21:25:36
Django version 1.10, using settings 'smart_audio.settings'
Starting development server at http://127.0.0.1:8100/
Quit the server with CTRL-BREAK.
D:\my_stuff\live\smart_audio\src\media/ /media/
[09/Jul/2017 21:25:37] "GET /playlist HTTP/1.1" 200 1569
[09/Jul/2017 21:25:38] "GET /media/audio/test_audio.mp3 HTTP/1.1" 200 8192
Traceback (most recent call last):
File "C:\Python27\lib\wsgiref\handlers.py", line 86, in run
self.finish_response()
File "C:\Python27\lib\wsgiref\handlers.py", line 128, in finish_response
self.write(data)
File "C:\Python27\lib\wsgiref\handlers.py", line 212, in write
self.send_headers()
File "C:\Python27\lib\wsgiref\handlers.py", line 270, in send_headers
self.send_preamble()
File "C:\Python27\lib\wsgiref\handlers.py", line 194, in send_preamble
'Date: %s\r\n' % format_date_time(time.time())
File "C:\Python27\lib\socket.py", line 324, in write
self.flush()
File "C:\Python27\lib\socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053] An established connection was aborted by the software in yo
ur host machine
[09/Jul/2017 21:25:38] "GET /media/audio/test_audio.mp3 HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 63304)
Traceback (most recent call last):
File "C:\Python27\lib\SocketServer.py", line 599, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\SocketServer.py", line 657, in __init__
self.finish()
File "C:\Python27\lib\SocketServer.py", line 716, in finish
self.wfile.close()
File "C:\Python27\lib\socket.py", line 279, in close
self.flush()
File "C:\Python27\lib\socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053] An established connection was aborted by the software in yo
ur host machine
----------------------------------------
chrome developer工具显示取消了get请求。如下面的img所示,音频文件名是test_audio.mp3
当我不使用django时,请使用简单的html。开发人员工具仍然显示相同的结果,但音频工作正常,我可以向前和向后移动。
任何帮助将不胜感激。