php - how to play/display video in a directory with html5 -
i not know how videos in folder play in html or php. know how single video that's not want. want display , play videos in directory folder. way this. tried code doesn't work , tried other codes. know in code below connected database. have managed upload videos can't display them.
none of solutions given working let me ask simpliar question can not 1 particular video videos path folder videos. think code above has lot of errors , 1 find i'm not trusting code above.
can try following?
<?php $query = "select * videos `id`='" . $id . "'"; $select = mysql_query($query); while (($row = mysql_fetch_assoc($select)) != null) { $video = $row['video']; print '<video width="320" height="240" controls>' . '<source src="uploadvideo/' . $video . '" type="video/mp4">' . '<source src="video/' . $video . '" type="video/ogg" />' . 'your browser not support video tag.' . '</video>'; } ?>
there few tweaks in there, such using backticks around column name, inputting message if browser not support video tag (taken here), , handling null result.
also, maybe need stick /
in front of video/
, uploadvideo/
? e.g. if videos located in 1 folder below document root, such wwww.mydomain.com/video/vid-name-here.mp4
another thing, have removed file extensions videos, or file extension kept in database both mp4 , ogg videos? perhaps want attach .mp4 , .ogg accordingly in source links so:
'<source src="uploadvideo/' . $video . '.mp4" type="video/mp4">' . '<source src="video/' . $video . '.ogg" type="video/ogg" />' .
Comments
Post a Comment