javascript - Adding a generated .srt into a HTML5 video -
i using php generate .srt file add html5 video, not working , showing message on console:
resource interpreted texttrack transferred mime type text/plain: "../subtitles/test%20edit.srt".
i using jquery script make video work http://www.storiesinflight.com/js_videosub/#download, works fine example, not .srt file.
i creating .srt file code:
$folder = 'subtitles/'; $filename = $this->get_title() . '.srt'; $fp = fopen($folder.$filename,'w'); $i = 1; $query = mysql_query("") or die(mysql_error()); while ($a = mysql_fetch_array($query)) { $subtitle = new subtitle($a['idsubtitle']); $text .= $i . chr(13) . chr(10) . $subtitle->get_start() . ',000 --> ' . $subtitle->get_end() . ',000' . chr(13) . chr(10) . $subtitle->get_text() . chr(13) . chr(10) . chr(13) . chr(10); $i++; } fwrite($fp,$text); fclose($fp);
it generating file:
1 00:00:01,000 --> 00:00:10,000 test 2 00:00:12,000 --> 00:00:15,000 test 2
as charlotte dunois said, you're not setting right mime type.
there multiple solutions this. 1 load .srt php page, changes mime type using header()
before content served. another, more practical, solution make web server figure out correct mime type itself, setting content-type header.
if you're using apache, mod_mime, otherwise documentation specific web server.
Comments
Post a Comment