1 window.cortadoDomainLocations = {
2 'upload.wikimedia.org' : 'http://upload.wikimedia.org/jars/cortado.jar',
3 'tinyvid.tv' : 'http://tinyvid.tv/static/cortado.jar',
4 'media.tinyvid.tv' : 'http://media.tinyvid.tv/cortado.jar'
8 instanceOf:'javaEmbed',
10 logged_domain_error:false,
17 'volume_control':false
19 getEmbedHTML : function (){
20 //big delay on embed html cuz its just for status updates and ie6 is crazy.
22 setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 500);
23 //set a default duration of 30 seconds: cortao should detect duration.
24 return this.wrapEmebedContainer( this.getEmbedObj() );
26 getEmbedObj:function(){
27 js_log("java play url:" + this.getURI( this.seek_time_sec ));
30 //if still unset set to an arbitrary time 60 seconds:
31 if(!this.duration)this.duration=60;
32 //@@todo we should have src property in our base embed object
33 var mediaSrc = this.getSrc();
35 if(mediaSrc.indexOf('://')!=-1 & parseUri(document.URL).host != parseUri(mediaSrc).host){
36 if(window.cortadoDomainLocations[parseUri(mediaSrc).host]){
37 applet_loc = window.cortadoDomainLocations[parseUri(mediaSrc).host];
39 applet_loc = 'http://theora.org/cortado.jar';
42 //should be identical to cortado.jar
43 applet_loc = mv_embed_path+'binPlayers/cortado/cortado.jar';
45 //load directly in the page..
46 // (media must be on the same server or applet must be signed)
47 var appplet_code = ''+
48 '<applet id="' + this.pid + '" code="com.fluendo.player.Cortado.class" archive="' + applet_loc + '" width="' + this.width + '" height="' + this.height + '"> '+ "\n"+
49 '<param name="url" value="' + mediaSrc + '" /> ' + "\n"+
50 '<param name="local" value="false"/>'+ "\n"+
51 '<param name="keepaspect" value="true" />'+ "\n"+
52 '<param name="video" value="true" />'+"\n"+
53 '<param name="showStatus" value="hide" />' + "\n"+
54 '<param name="audio" value="true" />'+"\n"+
55 '<param name="seekable" value="true" />'+"\n"+
56 '<param name="duration" value="' + this.duration + '" />'+"\n"+
57 '<param name="bufferSize" value="4096" />'+"\n"+
60 // Wrap it in an iframe to avoid hanging the event thread in FF 2/3 and similar
61 // Doesn't work in MSIE or Safari/Mac or Opera 9.5
62 if ( embedTypes.mozilla ) {
63 var iframe = document.createElement( 'iframe' );
64 iframe.setAttribute( 'width', params.width );
65 iframe.setAttribute( 'height', playerHeight );
66 iframe.setAttribute( 'scrolling', 'no' );
67 iframe.setAttribute( 'frameborder', 0 );
68 iframe.setAttribute( 'marginWidth', 0 );
69 iframe.setAttribute( 'marginHeight', 0 );
70 iframe.setAttribute( 'id', 'cframe_' + this.id)
71 elt.appendChild( iframe );
72 var newDoc = iframe.contentDocument;
74 newDoc.write( '<html><body>' + appplet_code + '</body></html>' );
75 newDoc.close(); // spurious error in some versions of FF, no workaround known
80 postEmbedJS:function(){
81 //reset logged domain error flag:
82 this.logged_domain_error = false;
88 if(this.jce && this.jce.getPlayPosition){
90 //java reads ogg media time.. so no need to add the start or seek offset:
91 //js_log(' ct: ' + this.jce.getPlayPosition() + ' ' + this.supportsURLTimeEncoding());
92 this.currentTime = this.jce.getPlayPosition();
93 if( this.jce.getPlayPosition() < 0){
94 js_log('pp:'+this.jce.getPlayPosition());
95 //probably reached clip end
99 js_log('could not get time from jPlayer: ' + e);
102 //once currentTime is updated call parent_monitor
103 this.parent_monitor();
106 * (local cortado seek does not seem to work very well)
108 doSeek:function(perc){
109 js_log('java:seek:p: ' + perc+ ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
112 if( this.supportsURLTimeEncoding() ){
113 this.parent_doSeek(perc);
114 //this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );
115 // this.jce.setParam('url', this.getURI( this.seek_time_sec ))
116 //this.jce.restart();
118 //do a (genneraly broken) local seek:
119 js_log("cortado javascript seems to always fail ... but here we go... doSeek(" + (perc * parseFloat(this.getDuration()) ) );
120 this.jce.doSeek( perc * parseFloat(this.getDuration()) );
122 this.doPlayThenSeek(perc);
125 doPlayThenSeek:function(perc){
126 js_log('doPlayThenSeek Hack');
130 var readyForSeek = function(){
132 //if we have .jre ~in theory~ we can seek (but probably not)
136 //try to get player for 10 seconds:
137 if( rfsCount < 200 ){
138 setTimeout(readyForSeek, 50);
141 js_log('error:doPlayThenSeek failed');
147 //get java cortado embed object
149 if ( embedTypes.mozilla ) {
150 this.jce = window.frames['cframe_' + this.id ].document.getElementById( this.pid );
152 this.jce = $j('#'+this.pid).get( 0 );
154 /*if( ! mv_java_iframe ){
157 if( $j('#iframe_' + this.pid ).length > 0 )
159 this.jce = $j('#iframe_' + this.pid ).get(0).contentWindow.jPlayer;
161 if(!this.logged_domain_error)
162 js_log("failed to grab jce we wont have time updates for java");
163 this.logged_domain_error = true;
169 doThumbnailHTML:function(){
170 //empty out player html (jquery with java applets does mix) :
171 var pelm = document.getElementById('dc_' + this.id );
173 this.parent_doThumbnailHTML();