Answer the question
In order to leave comments, you need to log in
Do I need decoding for modern video formats before inserting on the site?
I ask for advice.
I got a small site ads with real estate. And they asked to implement a feature so that people can upload videos of their objects when publishing an ad. Before that, I did not work with user-generated video content on sites. was focused on online stores, business sites, etc. Actually, I wrote down the function of sending a video file to the server and writing the value to the database. And now in the template I can display the path to the video file $video['path'].
Actually, the question is whether such a simple implementation will be enough for the vast majority of videos uploaded by users:
<?php
$ext = explode('.', $video['path']);
$ext = mb_strtolower(end($ext)); // получаем расширение видеофайла
if($ext == 'mov'){ // если формат mov
$ext = 'mp4';
}
?>
<video controls style="max-width:100%">
<source src="/upload/<?php echo $video['path']; ?>" type="video/<?php echo $ext; ?>">
Your browser does not support the video tag.
</video>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question