Jump to content

Doubt about extracting video properties and changing its settings...


Recommended Posts

I have been trying to extract the video properties from (.mp4) video files, as well as, textTracks.length and audioTracks.length, for example. But althought my browser is the Internet Explorer 11, the video file data doesn't carry into of the object complex variable called 'DOCUMENT' whose its several properties should be filled with those data. The result is that the values are only '0' !

How may i get the (.vtt) files? Is there a javascript function which prepares the data into a file, so that the object complex variable can be carried correctly? My thanks for the moderator.

Link to comment
Share on other sites

Hello, moderator:

Below there is a piece of the source code only for explanation. It's a sample of how a person could to extract the video properties from a video file. I suppose that the javascript code doesn't work perhaps because the javascript library is not updated, or it is partially damaged. Its version which i am using now is

'jquery-1.11.3.min.js'! ( it is on server directory )

All these video files showed below plays normally without problems, through javascript code which i've included into my web page.
Thanks for attention.
function info_video(){
var v=document.getElementById("myVideo");
var erro,texto_1,texto_2;
if(Logged == 0){ //It says:"you're not registered for the site, or didn't do your LOGIN for using this option!"
alert("Você não está cadastrado para o site, ou não fêz o seu login para usufruir desta opção!");erro=true;
}else{ //It says:"Type a number which identify a vídeo file wanted[1..8]:"
frase= prompt("Digite um número que identifica o vídeo desejado[1..8]:","1");
if(frase == null){
alert("Opção inválida!"); // It says:"Invalid option!
case "1":
texto_1 = "Propriedades do 1º vídeo:nn";v.src="The_Addams_Family01.mp4";break;
case "2":
texto_1 = "Propriedades do 2º vídeo:nn";v.src="The_Addams_Family02.mp4";break;
case "3":
texto_1 = "Propriedades do 3º vídeo:nn";v.src="The_Addams_Family03.mp4";break;
case "4":
texto_1 = "Propriedades do 4º vídeo:nn";v.src="The_Addams_Family04.mp4";break;
case "5":
texto_1 = "Propriedades do 5º vídeo:nn";v.src="The_Addams_Family05.mp4";break;
case "6":
texto_1 = "Propriedades do 6º vídeo:nn";v.src="The_Addams_Family06.mp4";break;
case "7":
texto_1 = "Propriedades do 7º vídeo:nn";v.src="The_Addams_Family07.mp4";break;
case "8":
texto_1 = "Propriedades do 8º vídeo:nn";v.src="The_Addams_Family08.mp4";break;
erro=true;alert("Opção fora da faixa!"); // It says:"The option is out of range!"
if( erro == true){
alert("Tente novamente mais tarde..."); // It says:"Try again later..."
v.load(); // It says:"Amount of audio tracks"
texto_1 +="a)Número de trilhas de áudio:[" + v.audioTracks.length+"]n___________________________________n";
// It says:"Amount fo text tracks"
texto_2 +="b)Número de trilhas de texto:[" + v.textTracks.length +"]n___________________________________n";
for(count=0;count < v.audioTracks.length;count++){ // It says:"The 'n' audio track uses language..."
texto_1 +="A " + (count+1).toFixed(0) +"ª trilha de áudio usa o idioma '" + v.audioTracks[count].language + "', ";
if(v.audioTracks[count].enabled == false){
texto_1 +="e não está habilitada;"; // It says:"and is not enabled;"
texto_1 +="e está habilitada;"; // It says:"and is enabled;"
} //fim-para
// requer o arquivo (.vtt) a pesquisa das trilhas de texto. It says that the (.vtt) file is required, although i do not know how to apply it.
for(count=0;count < v.textTracks.length;count++){ // It says:"The 'n' text track uses the language..."
texto_2 +="A " + (count+1).toFixed(0) +"ª trilha de texto usa o idioma '" + v.textTracks[count].language + "', ";
if(v.textTracks[count].mode == "disabled"){
texto_2 +="e está desabilitada;"; // It says:"and is disabled;"
if(v.textTracks[count].mode == "hidden"){
texto_2 +="e está oculta;"; // It says:"and is not visible;"
if(v.textTracks[count].mode == "showing"){
texto_2 +="e está visível;"; // It says:"and is visible;"
} //fim-para
// switch(v.error.code){
// case 0:alert("Nenhum êrro ocorrido até o momento."); // It says:"There's no error until the moment."
// It says:" There was an error while the file was being downloaded from the server for the station host. File corrupted."
// case 2:alert("Ocorreu um êrro quando o arquivo estava sendo baixado do servidor para a estação. Arquivo corrompido.");
// It says:" There was an error while the file was being decoding to be showed."
// case 3:alert("Ocorreu um êrro quando o arquivo estava sendo decodificado para exibição.");
// It says:" Invalid file name or file not found."
// case 4:alert("Nome de arquivo inválido ou arquivo não encontrado. ");
// }
} //fim-se
<button onclick="info_video()" type="button">Video properties</button>
<video id="myVideo" width="200" height="150" poster="The_Addams_Family.jpg" onended="video_played()">
<source src="The_Addams_Family01.mp4" type="video/mp4">
<source src="The_Addams_Family02.mp4" type="video/mp4">
<source src="The_Addams_Family03.mp4" type="video/mp4">
<source src="The_Addams_Family04.mp4" type="video/mp4">
<source src="The_Addams_Family05.mp4" type="video/mp4">
<source src="The_Addams_Family06.mp4" type="video/mp4">
<source src="The_Addams_Family07.mp4" type="video/mp4">
<source src="The_Addams_Family08.mp4" type="video/mp4">
Your browser doesn't support video based on HTML5!
Link to comment
Share on other sites

It may be true. I didn't include the HTML command lines about the (.vtt) files between the tags <video> and </video>. Even without that, the audio tracks properties, at least could be stored into the object complex variable. Do you agree? I don't know still how to build the (.vtt) files to use them im my project. I suppose that it will be solved when i study your text which you've sent for me.

Link to comment
Share on other sites

Do you think i'd need to build the (.vtt) files, instead of extracting the video properties from a video file into a object complex variable, through a javascript function? In case it happens, i think that it wouldn't be an easy way to solve the problem. I don't know how to prepare those (.vtt) files. :facepalm:

Link to comment
Share on other sites

  • 2 months later...

I knew that there is a good program which is able to prepare (.vtt) files, but i couldn't to download any version of the executable file for installation, because it hasn't been encountered for release!

Please, do you think you could help me to locate an URL address to download at least a shareware release of the application named:'HTML5 VIDEO CAPTION MAKER' ? Thanks. :sorry:

Link to comment
Share on other sites

Thank you very much. Now am worry with the security of my website. Is there any HTML tag or javascript instruction, which is able to avoid anyone to download my webpages through visitor browser?

Link to comment
Share on other sites

No, there's not. When someone loads your website they download your files, then their browser displays them. If you want people to see your website then you can't stop them from downloading anything. But letting people download things does not impact your site's security.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...