videos.js 1.36 KB
//
// Author Igor Amorim - www.igoramorim.com
//

function check_subtitle(file) {
    var accepted_file_types = ["srt"];
    return check_type(file, accepted_file_types)
};

function check_video(file) {
    var accepted_file_types = ["flv", "ts", "avi", "mp4", "mov", "webm", "wmv", "mkv",];
    return check_type(file, accepted_file_types)
};

function check_type(file, accepted_file_types) {

  var ext = file.value.substring(file.value.lastIndexOf('.') + 1).toLowerCase();
  var isValidFile = false;

  for (var i = 0; i < accepted_file_types.length; i++) {
      if (ext == accepted_file_types[i]) {
          isValidFile = true;
          break;
      }
  }

  if (!isValidFile) {
      file.value = null;
      alert("Apenas os formatos abaixo são aceitos:\n\n" + accepted_file_types.join(", "));
  }

  return isValidFile;
};

$(function(){

   $("#url").hide();
   $("#legend").hide();
   $("#link_cc").click(function(){
   	$("#url").show('slow');
	$("#legend").hide('slow');
   });

   $("#link_recognize").click(function(){
   	$("#url").show('slow');
	$("#legend").hide('slow');
   });

   $("#link_normal").click(function(){
   	$("#url").show('slow');
	$("#legend").show('slow');
   });

  $(function(){
  flowplayer("player2", "/player/flowplayer-3.2.9.swf",{
	onFinish: function(){ this.getPlugin("play").hide(); },
	canvas: { backgroundColor: "#FFFFFF" }
  });

});
});