aboutsummaryrefslogtreecommitdiff
path: root/js/video.js
blob: e724e8bf7cb831813d8bb3df41014eca7fe30090 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// $Id$

/**
 * @file
 * Adds some show/hide to the admin form to make the UXP easier.
 *
 */

$(document).ready(function() {
	//lets see if we have any jmedia movies
	if($.fn.media) {
		$('.jmedia').media();
	}
	
	video_hide_all_options();
	$("input[name='vid_convertor']").change(function() {
		video_hide_all_options();
	});
	
	$('.video_select').each(function() {
		var ext = $(this).attr('rel');
		$('select', this).change(function() {
			if($(this).val() == 'video_play_flv') {
				$('#flv_player_'+ext).show();
			} else {
				$('#flv_player_'+ext).hide();
			}
		});
		if($('select', this).val() == 'video_play_flv') {
			$('#flv_player_'+ext).show();
		}
	});
	
	if(Drupal.settings.video) {
		$.fn.media.defaults.flvPlayer = Drupal.settings.video.flvplayer;

	}
	
	//lets setup our colorbox videos
	$('.video-box').each(function() {
		var url = $(this).attr('href');
		var data = $(this).metadata();
		var width = data.width;
		var height= data.height;
		var player = Drupal.settings.video.player; //player can be either jwplayer or flowplayer.
		$(this).colorbox({
			html: '<a id="video-overlay" href="'+url+'" style="height:'+height+'; width:'+width+'; display: block;"></a>',
			onComplete:function() {
			  if(player == 'flowplayer') {
			    flowplayer("video-overlay", Drupal.settings.video.flvplayer, {
			    	clip: {
			    		autoPlay: Drupal.settings.video.autoplay,
			    		autoBuffering: Drupal.settings.video.autobuffer
			        }
			    });
			  } else {
				$('#video-overlay').media({ flashvars: {autostart: Drupal.settings.video.autoplay}, width:width, height:height }); 
			  }
			},
		});
	});
});

function video_hide_all_options() {
	$("input[name='vid_convertor']").each(function() {
		var id = $(this).val();
	    $('#'+id).hide();
		if ($(this).is(':checked')) {
			$('#' + id).show();
		}			
	});
}

function videoftp_thumbnail_change() {
    // Add handlers for the video thumbnail radio buttons to update the large thumbnail onchange.
	$(".video-thumbnails input").each(function() {
		var path = $(this).val();
		if($(this).is(':checked')) {
			var holder = $(this).attr('rel');
			$('.'+holder+' img').attr('src', Drupal.settings.basePath + path);
		}
	});

}