r80500 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80499‎ | r80500 | r80501 >
Date:16:41, 18 January 2011
Author:dale
Status:deferred
Tags:
Comment:
fixed swift transport support
Modified paths:
  • /branches/MwEmbedStandAlone/modules/P2PNextTransport/P2PNextTransport.i18n.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/P2PNextTransport/mw.P2PNextTransport.js (modified) (history)
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/P2PNextTransport/P2PNextTransport.i18n.php
@@ -9,7 +9,7 @@
1010 $messages = array();
1111 $messages['en'] = array(
1212 "mwe-swarmtransport-stream-ogg" => "Swarm Transport p2p Ogg stream",
13 - "mwe-swiftransport-stream-ogg" => "Swift Transport p2p Ogg stream",
 13+ "mwe-swifttransport-stream-ogg" => "Swift Transport p2p Ogg stream",
1414 "mwe-swarmtransport-recommend" => "To save bandwidth, please consider installing the P2P [$1 swarm transport add on]",
1515 "mwe-embedplayer-ogg-player-swarmTransportPlayer" => "Swarm Transport player",
1616 "mwe-embedplayer-ogg-player-swiftTransportPlayer" => "Swift Transport player",
Index: branches/MwEmbedStandAlone/modules/P2PNextTransport/mw.P2PNextTransport.js
@@ -32,7 +32,6 @@
3333
3434 // Bind some hooks to every player:
3535 $j( mw ).bind( 'newEmbedPlayerEvent', function( event, embedPlayer ) {
36 -
3736 // Setup the "embedCode" binding to swap in an updated url
3837 $j( embedPlayer ).bind( 'checkPlayerSourcesEvent', function( event, callback ) {
3938 // Confirm P2PNextTransport add-on is available
@@ -122,7 +121,7 @@
123122 mw.log("Warning: addSwarmSource: could not find video/ogg source to generate torrent from");
124123 callback();
125124 return ;
126 - }
 125+ }
127126 $.each( this.getTransportObjects(), function(inx, transportObject ){
128127 // Setup function to run in context based on callback result
129128 $j.getJSON(
@@ -132,23 +131,32 @@
133132 },
134133 function( data ){
135134 // Check if the torrent is ready:
136 - if( !data.torrent ){
 135+ if( !data.torrent && ! data ){
137136 mw.log( "P2PNext: ( " + transportObject.lookupUrl + " ) Torrent not ready status: " + data.status.text );
138137 callback( false );
139138 return ;
140139 }
141 - mw.log( 'SwarmTransport: addSwarmSource for: ' + source.getSrc() + "\n\nGot:" + data.torrent );
142 - // XXX need to update preference
 140+ mw.log( 'P2PNextTransport: addSwarmSource for: ' + source.getSrc() + "\n\nGot:" + data.torrent );
 141+
 142+ var transportSrc = '';
 143+ // Set the source via transportObject type
 144+ if( transportObject.name == 'swift'){
 145+ transportSrc = data.swift;
 146+ } else {
 147+ transportSrc = transportObject.protocol + data.torrent;
 148+ }
143149 embedPlayer.mediaElement.tryAddSource(
144150 $j('<source />')
145151 .attr( {
146 - 'type' : 'video/swarmTransport',
147 - 'title': gM('mwe-swarmtransport-stream-ogg'),
148 - 'src': transportObject.protocol + data.torrent,
 152+ 'type' : transportObject.mime,
 153+ 'title': gM('mwe-' + transportObject.name + 'transport-stream-ogg' ),
 154+ 'src': transportSrc,
149155 'default' : true
150156 } )
151157 .get( 0 )
152158 );
 159+ // XXX need to update preference
 160+
153161 callback( true );
154162 }
155163 );
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -4,7 +4,7 @@
55 */
66 var urlparts = getRemoteEmbedPath();
77 var mwEmbedHostPath = urlparts[0];
8 -var mwRemoteVersion = 'r187';
 8+var mwRemoteVersion = 'r188';
99
1010 // Log the mwRemote version makes it easy to debug cache issues
1111 if( window.console ){
@@ -95,7 +95,7 @@
9696 mwAddMediaConfig = {};
9797 }
9898 // Set legacy add media wizard config
99 -mwAddMediaConfig['enabled_providers'] = [ 'wiki_commons', 'upload' ]
 99+mwAddMediaConfig['enabled_providers'] = [ 'wiki_commons', 'upload' ];
100100
101101
102102 // Legacy Add media wizard config:
@@ -541,7 +541,7 @@
542542 $j( '<div />')
543543 .css({
544544 'width' : $pimg.attr('width' ),
545 - 'height' :$pimg.attr( 'height' ),
 545+ 'height' : $pimg.attr( 'height' ),
546546 'position' : 'relative',
547547 'background-color' : '#FFF'
548548 })

Status & tagging log