1
I would like to know how I can calculate and show the duration time of online videos that are in media files by remote URL using in this URL http://thumb.mais.uol.com.br/13277141.mp4 to give the duration of the video in case.
1
I would like to know how I can calculate and show the duration time of online videos that are in media files by remote URL using in this URL http://thumb.mais.uol.com.br/13277141.mp4 to give the duration of the video in case.
1
I suggest you take a look at getID3
You can access the page at this link!
the getID3
is a php clase to see the attributes of a file, see the following example;
<?php
Include ("getid3/getid3.php");
$filename="nome_do_video.mp4";
$getID3 = new getID3;
$file = $getID3->analize($filename);
echo $file['playtime_string'];
?>
If there are any questions please consult the page demo
on the website of getID3
0
I have a solution in Javascript. I know you wanted in PHP
, but this form below is more advisable as it works directly with the properties of the video without the need to API, EXECUTE THE CODE BELOW(comentários no código
):
//Criando as funcionalidades do video
var myVideo=document.getElementById("video1");
function playPause()
{
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function muteUnMute()
{
if( !myVideo.muted)
myVideo.muted='muted';
else
myVideo.muted=false;
}
//Criando as propriedades do video
var videoStartTime = 0;
var durationTime = 0;
myVideo.addEventListener('loadedmetadata', function() {
//DETERMINADO PONTO DE PARTIDA DO VÍDEO
videoStartTime = 0;
//DURAÇÃO DO VÍDEO PROGRAMADA
durationTime = 10;
this.currentTime = videoStartTime;
}, false);
//Função que conta o progresso do vídeo
myVideo.addEventListener('timeupdate', function() {
//Setando na div o a duração do vídeo
var div = document.getElementById('tempo');
div.innerHTML = this.currentTime;
//Condição para pausar o video em determinado tempo
if(this.currentTime > videoStartTime + durationTime){
this.pause();
}
});
<div style="text-align:center">
<h3>Contando o tempo: </h3><div id="tempo" style="color: red"></div>
<button onclick="playPause()">Play/Pausar</button>
<button onclick="muteUnMute()">SemSom/comSom</button>
<br>
<video id="video1" width="420">
<source src="mov_bbb.mp4" type="video/mp4">
<source src="http://thumb.mais.uol.com.br/13277141.mp4" type="video/ogg">
Seu browser não suporta HTML5 video.
</video>
</div>
Unfortunately it didn’t work just look at the test I did http://jsfiddle.net/Ryumaru/rcuuqz7c/ the video doesn’t even open the more shows the time values.
TENTE NO SEU SERVIDOR
. Here it works and in liveweave. Here’s a link in liveweave: http://liveweave.com/lhvIuI
Browser other questions tagged php meta-tags
You are not signed in. Login or sign up in order to post.
Jesus! I’m trying to implement this and it doesn’t work! The first mistake is in analyzing.. is ANALYZE, after that no matter what video I bring pro Analyze it always says it does not know the index: playtime_string. Did you help me?
– Bsalvo