Menu

[r80]: / trunk / player / StrobeMediaPlayback / html-template / configurator / js / application.js  Maximize  Restore  History

Download this file

136 lines (118 with data), 5.0 kB

  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
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
var flashVars = '';
var sourceSwf = '';
var width = '';
var height = '';
var extraVars= 0;
var defaultValues = {
initialBufferTime: '0.1',
expandedBufferTime: '10',
minContinuousPlaybackTime: '30'
}
var defaultWidth = 480;
var defaultHeight = 385;
var defaultSrc = 'http://osmf.org/configurator/videos/strobe.flv';
function changeSWFSource(sw) {
if (sw == "true") {
$("#source").val("http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf");
} else {
$("#source").val("http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf");
}
}
$(window).load(function () {
$("#source").val("http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf");
generateCode();
defaultWidth = $("#width").val();
defaultHeight = $("#height").val();
defaultSrc = $("#fv_src").val();
});
function toggleDisplay(itm) {
$("#"+itm).toggle();
}
function generateCode() {
changeSWFSource($("input:radio[name=use101]:checked").val());
getVars();
embedPlayer();
}
function embedPlayer() {
var embedCode = '<object width="' + width + '" height="' + height +'"> ';
embedCode += '<param name="movie" value="'+ sourceSwf + '"></param>';
embedCode += '<param name="flashvars" value="'+ flashVars + '"></param>';
embedCode += '<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>';
embedCode += '<embed src="' + sourceSwf + '" type="application/x-shockwave-flash"';
embedCode += ' allowscriptaccess="always" allowfullscreen="true" ';
embedCode += ' width="' + width + '" height="'+ height +'" ';
embedCode += 'flashvars="' + flashVars + '">';
embedCode += '</embed></object>';
$("#player").html(embedCode);
$("#swfobjcode").text(embedCode);
$("#swfobjcode").selText();
//printFlashVars();
}
function generatePreviewCode() {
var embedCode = '&lt;object width=&quot;' + width + '&quot; height=&quot;' + height +'&quot;&gt; <br/>';
embedCode += '&lt;param name=&quot;movie&quot; value=&quot;'+ sourceSwf + '&quot;&gt;&lt;/param&gt;<br/>';
embedCode += '&lt;param name=&quot;flashvars&quot; value=&quot;'+ flashVars + '&quot;&gt;&lt;/param&gt;<br/>';
embedCode += '&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;<br/>';
embedCode += '&lt;embed src=&quot;' + sourceSwf + '&quot; type=&quot;application/x-shockwave-flash&quot;<br/>';
embedCode += ' allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot;<br/> ';
embedCode += ' width=&quot;' + width + '&quot; height=&quot;'+ height +'&quot;<br/> ';
embedCode += 'flashvars=&quot;' + flashVars + '&quot;&gt; <br/>';
embedCode += '&lt;/embed&gt;&lt;/object&gt; <br/>';
}
function getVars() {
var values = $("input[value!=],select[value!=]").filter('[id^=fv_]').
filter(
function(index)
{
return !defaultValues[this.name] || this.value != defaultValues[this.name];
}
);
flashVars = values.serialize();
sourceSwf = $("#source").val();
width = $("#width").val();
height = $("#height").val();
}
function printFlashVars() {
var flashVarsArray = $("input[value!=],select[value!=]").filter('[id^=fv_]').serializeArray();
var outputVars = '';
outputVars += 'Source Swf: ' + sourceSwf + ' <br> ';
outputVars += ' width: ' + width + ' height: '+ height +' <br> ';
jQuery.each(flashVarsArray, function(i, flashvar){
outputVars += flashvar.name + ': ' + flashvar.value + ' <br> ';
});
$("#flashvarscode").html(outputVars);
}
function resetFields(){
$("#source").val("http://osmf.org/configurator/StrobeMediaPlayback.swf");
$(".default").attr("checked", "checked");
$(".defclear").val("");
$("#fv_streamType option[value='']").attr('selected', 'selected');
$("#fv_scaleMode option[value='']").attr('selected', 'selected');
$("#fv_initialBufferTime").val("0.1");
$("#fv_expandedBufferTime").val("10");
$("#width").val(defaultWidth);
$("#height").val(defaultHeight);
$("#fv_src").val(defaultSrc);
//$("#fv_backgroundColor").color.fromString("FFFFFF");
document.getElementById('fv_backgroundColor').color.fromString('FFFFFF');
$('#fv_backgroundColor').val("");
generateCode();
}
jQuery.fn.selText = function() {
var obj = this[0];
if ($.browser.msie) {
var range = obj.offsetParent.createTextRange();
range.moveToElementText(obj);
range.select();
} else if ($.browser.mozilla || $.browser.opera) {
var selection = obj.ownerDocument.defaultView.getSelection();
var range = obj.ownerDocument.createRange();
range.selectNodeContents(obj);
selection.removeAllRanges();
selection.addRange(range);
} else if ($.browser.safari) {
var selection = obj.ownerDocument.defaultView.getSelection();
selection.setBaseAndExtent(obj, 0, obj, 1);
}
return this;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.