r69395 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69394‎ | r69395 | r69396 >
Date:17:24, 15 July 2010
Author:dale
Status:deferred
Tags:
Comment:
renamed "mediaRss" to "playlist"
Playlist module now supports multiple underlining playist formats via abstract playlistSourceHandler
Modified paths:
  • /branches/MwEmbedStandAlone/modules/MediaRss (deleted) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/MediaRss.i18n.php (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/Playlist.i18n.php (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/README (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/loader.js (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/mw.PlaylistHandlerMediaRss.js (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/tests (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/tests/Player_MediaRss.html (added) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/tests/kalturaInterviewPlaylist.xml (added) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/Playlist/loader.js
@@ -0,0 +1,58 @@
 2+/**
 3+* MediaRssPlayer
 4+*/
 5+
 6+// Wrap in mw to not pollute global namespace
 7+( function( mw ) {
 8+
 9+ mw.addResourcePaths( {
 10+ "mw.Playlist" : "mw.Playlist.js",
 11+ "mw.PlaylistHandlerMediaRss" : "mw.PlaylistHandlerMediaRss.js"
 12+ });
 13+
 14+ // Set the default config
 15+ mw.setDefaultConfig( {
 16+ // Playlist layout 'vertical' or 'horizontal'
 17+ 'Playlist.layout' : 'vertical',
 18+
 19+ // Player aspect ratio
 20+ 'Playlist.playerAspect' : '4:3',
 21+
 22+ // Width of item thubmnails
 23+ 'Playlist.itemThumbWidth' : '60',
 24+
 25+ // Height of the mediaRss title
 26+ 'Playlist.titleHeight' : '20',
 27+
 28+ // Default playlist type:
 29+ 'Playlist.defaultType' : 'application/rss+xml'
 30+ } );
 31+
 32+ // Module loader ( right now its just a stub for mw.MediaRss )
 33+ mw.addModuleLoader( 'Playlist', [ "mw.Playlist", "mw.PlaylistHandlerMediaRss" ] );
 34+
 35+} )( window.mw );
 36+
 37+// Add the jQuery hook:
 38+( function( $ ) {
 39+ $.fn.playlist = function( options ){
 40+ var _this = this;
 41+ if ( !this.selector ) {
 42+ mw.log( "Error: Calling mediaRssPlayer with empty selector " + this.selector);
 43+ return ;
 44+ }
 45+ // Set the target to loading
 46+ $j( this.selector ).loadingSpinner();
 47+
 48+ // Set the target
 49+ options[ 'target' ] = _this.selector;
 50+
 51+ // Load the mediaRss class ( if not already loaded )
 52+ mw.load ( ['EmbedPlayer', 'Playlist'], function(){
 53+ // load and display the media Rss
 54+ var myPlaylist = new mw.Playlist( options );
 55+ myPlaylist.drawUI();
 56+ });
 57+ }
 58+} )( jQuery );
 59+
Property changes on: branches/MwEmbedStandAlone/modules/Playlist/loader.js
___________________________________________________________________
Added: svn:eol-style
160 + native
Index: branches/MwEmbedStandAlone/modules/Playlist/tests/kalturaInterviewPlaylist.xml
@@ -0,0 +1,357 @@
 2+<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:kaltura="http://kaltura.com/playlist/1.0" >
 3+
 4+<channel>
 5+ <description>Kaltura's mRss </description>
 6+ <title>Kaltura's mRss</title>
 7+ <link>/index.php/partnerservices2/executeplaylist?uid=&amp;partner_id=224962&amp;subp_id=22496200&amp;format=8&amp;ks=%7Bks%7D&amp;playlist_id=0_eat1eoc9&amp;amp;</link>
 8+<item>
 9+ <description>Test item</description>
 10+<guid isPermaLink="false">224962|0_ch2dcq4g</guid>
 11+ <link></link>
 12+ <pubDate>2010-06-02 09:36:11</pubDate>
 13+ <media:content url="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb_trailer_iphone270P.m4v" type="video/h264" medium="video" duration="33" lang="en"/>
 14+ <media:content url="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb_trailer_400p.ogv" type="video/ogg" medium="video" duration="33" lang="en"/>
 15+ <media:title type="plain">
 16+Big buck bunny test clip
 17+</media:title>
 18+<media:description>
 19+test description.</media:description>
 20+<media:keywords>
 21+ Johan Janssens (@johanjanssens) jab10, jandbeyond, jab third day, day 3, joomla, interview Interview with Johan Janssens at JandBeyond 2010, The first international Joomla Conference. About the his experience with Joomla and the community. </media:keywords>
 22+<media:thumbnail url="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb480.jpg"/>
 23+<media:credit role="kaltura partner">
 24+224962</media:credit>
 25+<kaltura:entryId>
 26+0_ch2dcq4g</kaltura:entryId>
 27+<kaltura:views>
 28+215</kaltura:views>
 29+<kaltura:plays>
 30+48</kaltura:plays>
 31+<kaltura:userScreenName>
 32+</kaltura:userScreenName>
 33+<kaltura:puserId>
 34+__ADMIN__224562</kaltura:puserId>
 35+<kaltura:userLandingPage>
 36+</kaltura:userLandingPage>
 37+<kaltura:partnerLandingPage>
 38+</kaltura:partnerLandingPage>
 39+<kaltura:tags>
 40+jab10, jandbeyond, jab third day, day 3, joomla, interview</kaltura:tags>
 41+<kaltura:adminTags>
 42+</kaltura:adminTags>
 43+<kaltura:votes>
 44+0</kaltura:votes>
 45+<kaltura:rank>
 46+0</kaltura:rank>
 47+<kaltura:createdAt>
 48+2010-06-02 09:36:11</kaltura:createdAt>
 49+<kaltura:createdAtInt>
 50+1275485771</kaltura:createdAtInt>
 51+<kaltura:sourceLink>
 52+file:/web/content/uploads/4ff9a66e96e7df7aa7a0a0932c675928_493f046d1df3ec39b0f3421a955063cb.AVI_.avi</kaltura:sourceLink>
 53+<kaltura:credit>
 54+</kaltura:credit>
 55+</item>
 56+<item>
 57+<description>
 58+Kaltura Item</description>
 59+<guid isPermaLink="false">
 60+224962|0_o42ef9f1</guid>
 61+<link>
 62+</link>
 63+<pubDate>
 64+2010-06-02 09:36:01</pubDate>
 65+<media:content url="http://cdn.kaltura.com/p/224962/sp/22496200/flvclipper/entry_id/0_o42ef9f1/version/0/ext/flv" type="video/x-flv" medium="video" duration="485" lang="en"/>
 66+ <media:title type="plain">
 67+Nick Balestra, Romano Sensibile &amp; Luca Zerboni @ohanahworld</media:title>
 68+<media:description>
 69+Interview with Nick Balestra, Romano Sensibile &amp; Luca Zerboni from Ohanah at JandBeyond 2010, The first international Joomla Conference. About the their experience with Joomla, the community and about their new project Ohanah for managing events.</media:description>
 70+<media:keywords>
 71+ Nick Balestra, Romano Sensibile &amp; Luca Zerboni @ohanahworld jab10, jandbeyond, jab third day, day 3, joomla, interview Interview with Nick Balestra, Romano Sensibile &amp; Luca Zerboni from Ohanah at JandBeyond 2010, The first international Joomla Conference. About the their experience with Joomla, the community and about their new project Ohanah for managing events. </media:keywords>
 72+<media:thumbnail url="http://cdn.kaltura.com/p/224962/sp/22496200/thumbnail/entry_id/0_o42ef9f1/version/100003/width/640/height/480"/>
 73+<media:credit role="kaltura partner">
 74+224962</media:credit>
 75+<kaltura:entryId>
 76+0_o42ef9f1</kaltura:entryId>
 77+<kaltura:views>
 78+25</kaltura:views>
 79+<kaltura:plays>
 80+22</kaltura:plays>
 81+<kaltura:userScreenName>
 82+</kaltura:userScreenName>
 83+<kaltura:puserId>
 84+__ADMIN__224562</kaltura:puserId>
 85+<kaltura:userLandingPage>
 86+</kaltura:userLandingPage>
 87+<kaltura:partnerLandingPage>
 88+</kaltura:partnerLandingPage>
 89+<kaltura:tags>
 90+jab10, jandbeyond, jab third day, day 3, joomla, interview</kaltura:tags>
 91+<kaltura:adminTags>
 92+</kaltura:adminTags>
 93+<kaltura:votes>
 94+0</kaltura:votes>
 95+<kaltura:rank>
 96+0</kaltura:rank>
 97+<kaltura:createdAt>
 98+2010-06-02 09:36:01</kaltura:createdAt>
 99+<kaltura:createdAtInt>
 100+1275485761</kaltura:createdAtInt>
 101+<kaltura:sourceLink>
 102+file:/web/content/uploads/4ff9a66e96e7df7aa7a0a0932c675928_1e5c42d3c1dcb47020c6f8b87f78e221.AVI_.avi</kaltura:sourceLink>
 103+<kaltura:credit>
 104+</kaltura:credit>
 105+</item>
 106+<item>
 107+<description>
 108+Kaltura Item</description>
 109+<guid isPermaLink="false">
 110+224962|0_9ohw2xrf</guid>
 111+<link>
 112+</link>
 113+<pubDate>
 114+2010-06-02 09:35:29</pubDate>
 115+<media:content url="http://cdn.kaltura.com/p/224962/sp/22496200/flvclipper/entry_id/0_9ohw2xrf/version/0/ext/flv" type="video/x-flv" medium="video" duration="1740" lang="en"/>
 116+ <media:title type="plain">
 117+Fotis Evangelou &amp; Lefteris Kavadas (@joomlaworks)</media:title>
 118+<media:description>
 119+Interview with Fotis Evangelou &amp; Lefteris Kavadas from Joomla Works at JandBeyond 2010, The first international Joomla Conference. About the their experience with Joomla and the community. And about K2, their successful Joomla extension.</media:description>
 120+<media:keywords>
 121+ Fotis Evangelou &amp; Lefteris Kavadas (@joomlaworks) jab10, jandbeyond, jab third day, day 3, joomla, interview Interview with Fotis Evangelou &amp; Lefteris Kavadas from Joomla Works at JandBeyond 2010, The first international Joomla Conference. About the their experience with Joomla and the community. And about K2, their successful Joomla extension. </media:keywords>
 122+<media:thumbnail url="http://cdn.kaltura.com/p/224962/sp/22496200/thumbnail/entry_id/0_9ohw2xrf/version/100003/width/640/height/480"/>
 123+<media:credit role="kaltura partner">
 124+224962</media:credit>
 125+<kaltura:entryId>
 126+0_9ohw2xrf</kaltura:entryId>
 127+<kaltura:views>
 128+43</kaltura:views>
 129+<kaltura:plays>
 130+52</kaltura:plays>
 131+<kaltura:userScreenName>
 132+</kaltura:userScreenName>
 133+<kaltura:puserId>
 134+__ADMIN__224562</kaltura:puserId>
 135+<kaltura:userLandingPage>
 136+</kaltura:userLandingPage>
 137+<kaltura:partnerLandingPage>
 138+</kaltura:partnerLandingPage>
 139+<kaltura:tags>
 140+jab10, jandbeyond, jab third day, day 3, joomla, interview</kaltura:tags>
 141+<kaltura:adminTags>
 142+</kaltura:adminTags>
 143+<kaltura:votes>
 144+0</kaltura:votes>
 145+<kaltura:rank>
 146+0</kaltura:rank>
 147+<kaltura:createdAt>
 148+2010-06-02 09:35:29</kaltura:createdAt>
 149+<kaltura:createdAtInt>
 150+1275485729</kaltura:createdAtInt>
 151+<kaltura:sourceLink>
 152+file:/web/content/uploads/4ff9a66e96e7df7aa7a0a0932c675928_b5e251dd0166d187ea136d0a8b2994e2.AVI_.avi</kaltura:sourceLink>
 153+<kaltura:credit>
 154+</kaltura:credit>
 155+</item>
 156+<item>
 157+<description>
 158+Kaltura Item</description>
 159+<guid isPermaLink="false">
 160+224962|0_fw21xe2q</guid>
 161+<link>
 162+</link>
 163+<pubDate>
 164+2010-06-02 07:25:48</pubDate>
 165+<media:content url="http://cdn.kaltura.com/p/224962/sp/22496200/flvclipper/entry_id/0_fw21xe2q/version/0/ext/flv" type="video/x-flv" medium="video" duration="588" lang="en"/>
 166+ <media:title type="plain">
 167+Mathias Verraes (@mathiasverraes)</media:title>
 168+<media:description>
 169+Interview with Mathias Verraes at JandBeyond 2010, The first international Joomla Conference. About the his experience with Joomla and the community.</media:description>
 170+<media:keywords>
 171+ Mathias Verraes (@mathiasverraes) jab10, jandbeyond, jab10 day 2, interviews Interview with Mathias Verraes at JandBeyond 2010, The first international Joomla Conference. About the his experience with Joomla and the community. </media:keywords>
 172+<media:thumbnail url="http://cdn.kaltura.com/p/224962/sp/22496200/thumbnail/entry_id/0_fw21xe2q/version/100002/width/640/height/480"/>
 173+<media:credit role="kaltura partner">
 174+224962</media:credit>
 175+<kaltura:entryId>
 176+0_fw21xe2q</kaltura:entryId>
 177+<kaltura:views>
 178+25</kaltura:views>
 179+<kaltura:plays>
 180+19</kaltura:plays>
 181+<kaltura:userScreenName>
 182+</kaltura:userScreenName>
 183+<kaltura:puserId>
 184+__ADMIN__224562</kaltura:puserId>
 185+<kaltura:userLandingPage>
 186+</kaltura:userLandingPage>
 187+<kaltura:partnerLandingPage>
 188+</kaltura:partnerLandingPage>
 189+<kaltura:tags>
 190+jab10, jandbeyond, jab10 day 2, interviews</kaltura:tags>
 191+<kaltura:adminTags>
 192+</kaltura:adminTags>
 193+<kaltura:votes>
 194+0</kaltura:votes>
 195+<kaltura:rank>
 196+0</kaltura:rank>
 197+<kaltura:createdAt>
 198+2010-06-02 07:25:48</kaltura:createdAt>
 199+<kaltura:createdAtInt>
 200+1275477948</kaltura:createdAtInt>
 201+<kaltura:sourceLink>
 202+file:/web/content/uploads/4ff9a66e96e7df7aa7a0a0932c675928_af3e46261ec9e57704d0aeb377977689.flv_.flv</kaltura:sourceLink>
 203+<kaltura:credit>
 204+</kaltura:credit>
 205+</item>
 206+<item>
 207+<description>
 208+Kaltura Item</description>
 209+<guid isPermaLink="false">
 210+224962|0_puj3u02q</guid>
 211+<link>
 212+</link>
 213+<pubDate>
 214+2010-06-02 07:25:44</pubDate>
 215+<media:content url="http://cdn.kaltura.com/p/224962/sp/22496200/flvclipper/entry_id/0_puj3u02q/version/0/ext/flv" type="video/x-flv" medium="video" duration="717" lang="en"/>
 216+ <media:title type="plain">
 217+Ryan Ozimek (@cozimek)</media:title>
 218+<media:description>
 219+Interview with Ryan Ozimek, president of the OpenSourceMatters NGO at JandBeyond 2010, The first international Joomla Conference. About the his experience with Joomla and the community.</media:description>
 220+<media:keywords>
 221+ Ryan Ozimek (@cozimek) jab10, jandbeyond, jab10 day 2, interviews Interview with Ryan Ozimek, president of the OpenSourceMatters NGO at JandBeyond 2010, The first international Joomla Conference. About the his experience with Joomla and the community. </media:keywords>
 222+<media:thumbnail url="http://cdn.kaltura.com/p/224962/sp/22496200/thumbnail/entry_id/0_puj3u02q/version/100001/width/640/height/480"/>
 223+<media:credit role="kaltura partner">
 224+224962</media:credit>
 225+<kaltura:entryId>
 226+0_puj3u02q</kaltura:entryId>
 227+<kaltura:views>
 228+18</kaltura:views>
 229+<kaltura:plays>
 230+16</kaltura:plays>
 231+<kaltura:userScreenName>
 232+</kaltura:userScreenName>
 233+<kaltura:puserId>
 234+__ADMIN__224562</kaltura:puserId>
 235+<kaltura:userLandingPage>
 236+</kaltura:userLandingPage>
 237+<kaltura:partnerLandingPage>
 238+</kaltura:partnerLandingPage>
 239+<kaltura:tags>
 240+jab10, jandbeyond, jab10 day 2, interviews</kaltura:tags>
 241+<kaltura:adminTags>
 242+</kaltura:adminTags>
 243+<kaltura:votes>
 244+0</kaltura:votes>
 245+<kaltura:rank>
 246+0</kaltura:rank>
 247+<kaltura:createdAt>
 248+2010-06-02 07:25:44</kaltura:createdAt>
 249+<kaltura:createdAtInt>
 250+1275477944</kaltura:createdAtInt>
 251+<kaltura:sourceLink>
 252+file:/web/content/uploads/4ff9a66e96e7df7aa7a0a0932c675928_fec7c133944fdb076487c1ca6f469479.flv_.flv</kaltura:sourceLink>
 253+<kaltura:credit>
 254+</kaltura:credit>
 255+</item>
 256+<item>
 257+<description>
 258+Kaltura Item</description>
 259+<guid isPermaLink="false">
 260+224962|0_9t85vbjy</guid>
 261+<link>
 262+</link>
 263+<pubDate>
 264+2010-06-02 07:25:40</pubDate>
 265+<media:content url="http://cdn.kaltura.com/p/224962/sp/22496200/flvclipper/entry_id/0_9t85vbjy/version/0/ext/flv" type="video/x-flv" medium="video" duration="494" lang="en"/>
 266+ <media:title type="plain">
 267+Dinh Viet Hung - Dan Partac (@joomlart)</media:title>
 268+<media:description>
 269+Interview with Dinh Viet Hung and Dan Partac from JoomlArt at JandBeyond 2010, The first international Joomla Conference. About the their experience with Joomla and the community.</media:description>
 270+<media:keywords>
 271+ Dinh Viet Hung - Dan Partac (@joomlart) jab10, jandbeyond, jab10 day 2, interviews Interview with Dinh Viet Hung and Dan Partac from JoomlArt at JandBeyond 2010, The first international Joomla Conference. About the their experience with Joomla and the community. </media:keywords>
 272+<media:thumbnail url="http://cdn.kaltura.com/p/224962/sp/22496200/thumbnail/entry_id/0_9t85vbjy/version/100001/width/640/height/480"/>
 273+<media:credit role="kaltura partner">
 274+224962</media:credit>
 275+<kaltura:entryId>
 276+0_9t85vbjy</kaltura:entryId>
 277+<kaltura:views>
 278+24</kaltura:views>
 279+<kaltura:plays>
 280+26</kaltura:plays>
 281+<kaltura:userScreenName>
 282+</kaltura:userScreenName>
 283+<kaltura:puserId>
 284+__ADMIN__224562</kaltura:puserId>
 285+<kaltura:userLandingPage>
 286+</kaltura:userLandingPage>
 287+<kaltura:partnerLandingPage>
 288+</kaltura:partnerLandingPage>
 289+<kaltura:tags>
 290+jab10, jandbeyond, jab10 day 2, interviews</kaltura:tags>
 291+<kaltura:adminTags>
 292+</kaltura:adminTags>
 293+<kaltura:votes>
 294+0</kaltura:votes>
 295+<kaltura:rank>
 296+0</kaltura:rank>
 297+<kaltura:createdAt>
 298+2010-06-02 07:25:40</kaltura:createdAt>
 299+<kaltura:createdAtInt>
 300+1275477940</kaltura:createdAtInt>
 301+<kaltura:sourceLink>
 302+file:/web/content/uploads/4ff9a66e96e7df7aa7a0a0932c675928_b8437f8f0eb76316de80250cec9791c9.flv_.flv</kaltura:sourceLink>
 303+<kaltura:credit>
 304+</kaltura:credit>
 305+</item>
 306+<item>
 307+<description>
 308+Kaltura Item</description>
 309+<guid isPermaLink="false">
 310+224962|0_aek19dzy</guid>
 311+<link>
 312+</link>
 313+<pubDate>
 314+2010-06-01 11:45:13</pubDate>
 315+<media:content url="http://cdn.kaltura.com/p/224962/sp/22496200/flvclipper/entry_id/0_aek19dzy/version/0/ext/flv" type="video/x-flv" medium="video" duration="615" lang="en"/>
 316+ <media:title type="plain">
 317+Sarah Watz (@sarahwatz)</media:title>
 318+<media:description>
 319+Interview with Sarah Watz from the Norwegian JUG (Joomla User Group) at JandBeyond 2010, The first international Joomla Conference. About the her experience with Joomla and the community.</media:description>
 320+<media:keywords>
 321+ Sarah Watz (@sarahwatz) jab10, jandbeyond, j and beyond, joomla, interviews day 1 Interview with Sarah Watz from the Norwegian JUG (Joomla User Group) at JandBeyond 2010, The first international Joomla Conference. About the her experience with Joomla and the community. </media:keywords>
 322+<media:thumbnail url="http://cdn.kaltura.com/p/224962/sp/22496200/thumbnail/entry_id/0_aek19dzy/version/100002/width/640/height/480"/>
 323+<media:credit role="kaltura partner">
 324+224962</media:credit>
 325+<kaltura:entryId>
 326+0_aek19dzy</kaltura:entryId>
 327+<kaltura:views>
 328+34</kaltura:views>
 329+<kaltura:plays>
 330+27</kaltura:plays>
 331+<kaltura:userScreenName>
 332+</kaltura:userScreenName>
 333+<kaltura:puserId>
 334+__ADMIN__224562</kaltura:puserId>
 335+<kaltura:userLandingPage>
 336+</kaltura:userLandingPage>
 337+<kaltura:partnerLandingPage>
 338+</kaltura:partnerLandingPage>
 339+<kaltura:tags>
 340+jab10, jandbeyond, j and beyond, joomla, interviews day 1</kaltura:tags>
 341+<kaltura:adminTags>
 342+</kaltura:adminTags>
 343+<kaltura:votes>
 344+0</kaltura:votes>
 345+<kaltura:rank>
 346+0</kaltura:rank>
 347+<kaltura:createdAt>
 348+2010-06-01 11:45:13</kaltura:createdAt>
 349+<kaltura:createdAtInt>
 350+1275407113</kaltura:createdAtInt>
 351+<kaltura:sourceLink>
 352+file:/web/content/uploads/4ff9a66e96e7df7aa7a0a0932c675928_cd781cb7ae25bc141189e988a5ec28d3.AVI_.avi</kaltura:sourceLink>
 353+<kaltura:credit>
 354+</kaltura:credit>
 355+</item>
 356+</channel>
 357+</rss>
 358+
Index: branches/MwEmbedStandAlone/modules/Playlist/tests/Player_MediaRss.html
@@ -0,0 +1,48 @@
 2+<html>
 3+<head>
 4+<title> MediaRss player </title>
 5+
 6+<script type="text/javascript" src="../../../mwEmbed.js?debug=true>"></script>
 7+
 8+<!--
 9+<script type="text/javascript" src="http://html5.kaltura.org/js"></script>
 10+<script type="text/javascript" src="../../../mwEmbedLoader.js"></script>
 11+<script type="text/javascript" src="../mwEmbed/mwEmbedLoader.js"></script>
 12+<script type="text/javascript" src="../mwEmbed/mwEmbed.js?debug=true>"></script>
 13+<script type="text/javascript" src="../../../ResourceLoader.php?class=window.jQuery,mwEmbed&debug=true"></script>
 14+-->
 15+
 16+<script type="text/javascript">
 17+ // For testing safari in chrome /
 18+ if( document.URL.indexOf('forceMobileSafari') != -1 ){
 19+ mw.setConfig( 'forceMobileSafari' , true );
 20+ }
 21+
 22+ mw.ready( function(){
 23+ $j('#mediaRssTarget').playlist({
 24+ 'src' : "kalturaInterviewPlaylist.xml",
 25+ 'type' : 'application/rss+xml',
 26+ 'layout' : 'vertical'
 27+ });
 28+
 29+ $j('#mediaRssTargetHorizontal').playlist({
 30+ 'src' : "kalturaInterviewPlaylist.xml",
 31+ 'type' : 'application/rss+xml',
 32+ 'layout' : 'horizontal'
 33+ });
 34+ });
 35+</script>
 36+</head>
 37+<body>
 38+<h2> Sample MediaRss Playlist </h2>
 39+<br />
 40+
 41+Sample Media Rss ( <a href="kalturaInterviewPlaylist.xml">kalturaInterviewPlay.xml</a> ) Vertical
 42+
 43+ <div style="width:400px;height:500px" id="mediaRssTarget"> </div>
 44+<br/><br/><br/>
 45+Sample Media Rss ( <a href="kalturaInterviewPlaylist.xml">kalturaInterviewPlay.xml</a> ) horizontal
 46+ <div style="width:700px;height:300px" id="mediaRssTargetHorizontal"> </div>
 47+<br/><br/><br/>
 48+</body>
 49+</html>
\ No newline at end of file
Index: branches/MwEmbedStandAlone/modules/Playlist/mw.PlaylistHandlerMediaRss.js
@@ -0,0 +1,108 @@
 2+
 3+mw.PlaylistHandlerMediaRss = function( Playlist ){
 4+ return this.init( Playlist );
 5+}
 6+
 7+mw.PlaylistHandlerMediaRss.prototype = {
 8+ // Set the media rss namespace
 9+ mediaNS: 'http://search.yahoo.com/mrss/',
 10+
 11+ init: function ( Playlist ){
 12+ this.playlist = Playlist;
 13+ },
 14+
 15+ /**
 16+ * load the playlist source file with a callback
 17+ */
 18+ loadPlaylist: function( callback ){
 19+ var _this = this;
 20+ // check if we already have the $rss loaded
 21+ if( this.$rss ){
 22+ callback( this.$rss );
 23+ return ;
 24+ }
 25+ // Note this only works with local sources
 26+ $j.get( mw.absoluteUrl( this.playlist.src ), function( data ){
 27+ _this.$rss = $j( data );
 28+ callback( _this.$rss );
 29+ });
 30+ },
 31+
 32+ // Get clip count
 33+ getClipCount: function(){
 34+ if( !this.$rss ){
 35+ mw.log("Error no rss to count items" );
 36+ }
 37+ return this.$rss.find('item').length;
 38+ },
 39+
 40+ getClipSources: function( clipIndex, callback ){
 41+ var _this = this;
 42+ var $item = $j( this.$rss.find('item')[ clipIndex ] );
 43+ var clipSources = [];
 44+ $j.each( $item.get(0).getElementsByTagNameNS( _this.mediaNS, 'content' ), function( inx, mediaContent){
 45+ if( $j( mediaContent ).get(0).nodeName == 'media:content' ){
 46+ clipSource = {}
 47+ if( $j( mediaContent ).attr('url' ) ){
 48+ clipSource.src = $j( mediaContent ).attr('url' );
 49+ }
 50+ if( $j( mediaContent ).attr('type' ) ){
 51+ clipSource.type = $j( mediaContent ).attr('type' );
 52+ }
 53+ if( $j( mediaContent ).attr( 'duration' ) ) {
 54+ clipSource.durationHint = $j( mediaContent ).attr('duration' );
 55+ }
 56+ clipSources.push( clipSource );
 57+ }
 58+ });
 59+ callback( clipSources );
 60+ },
 61+
 62+ getCustomClipAttributes: function( clipIndex ){
 63+ return {};
 64+ },
 65+
 66+ getClipList: function(){
 67+ return this.$rss.find('item');
 68+ },
 69+ /**
 70+ * Get an items poster image ( return missing thumb src if not found )
 71+ */
 72+ getClipPoster: function ( clipIndex ){
 73+ var $item = this.$rss.find('item').eq( clipIndex );
 74+ var mediaThumb = $item.get(0).getElementsByTagNameNS( this.mediaNS, 'thumbnail' );
 75+ mw.log( 'MEDIAthumb: ' + $j( mediaThumb ).attr('url' ) );
 76+ if( mediaThumb && $j( mediaThumb ).attr('url' ) ){
 77+ return $j( mediaThumb ).attr('url' );
 78+ }
 79+
 80+ // return missing thumb url
 81+ return mw.getConfig( 'imagesPath' ) + 'vid_default_thumb.jpg';
 82+ },
 83+ /**
 84+ * Get an item title from the $rss source
 85+ */
 86+ getClipTitle: function( clipIndex ){
 87+ var $item = this.$rss.find('item').eq( clipIndex ) ;
 88+ var mediaTitle = $item.get(0).getElementsByTagNameNS( this.mediaNS, 'title' );
 89+ if( mediaTitle ){
 90+ return $j( mediaTitle ).text();
 91+ }
 92+ mw.log("Error could not find title for clip: " + clipIndex );
 93+ return gM('mwe-mediarss-untitled');
 94+ },
 95+
 96+ getClipDuration: function ( clipIndex ) {
 97+ // return the first found media duration
 98+ var $item = this.$rss.find('item').eq( clipIndex ) ;
 99+ var itemDuration = 0;
 100+ $j( $item.get(0).getElementsByTagNameNS( this.mediaNS, 'content' ) ).each( function( inx, mediaContent ){
 101+ if( $j( mediaContent ).attr( 'duration' ) ) {
 102+ itemDuration = $j( mediaContent ).attr( 'duration' );
 103+ // end for loop
 104+ return false;
 105+ }
 106+ });
 107+ return mw.seconds2npt( itemDuration )
 108+ }
 109+}
\ No newline at end of file
Property changes on: branches/MwEmbedStandAlone/modules/Playlist/mw.PlaylistHandlerMediaRss.js
___________________________________________________________________
Added: svn:eol-style
1110 + native
Index: branches/MwEmbedStandAlone/modules/Playlist/Playlist.i18n.php
@@ -0,0 +1,12 @@
 2+<?php
 3+/**
 4+ * Internationalisation for javascript Playlist module
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+$messages['en'] = array(
 12+ 'mwe-playlist-empty' => 'Error: empty or not valid playlist',
 13+);
\ No newline at end of file
Property changes on: branches/MwEmbedStandAlone/modules/Playlist/Playlist.i18n.php
___________________________________________________________________
Added: svn:eol-style
114 + native
Index: branches/MwEmbedStandAlone/modules/Playlist/MediaRss.i18n.php
@@ -0,0 +1,12 @@
 2+<?php
 3+/**
 4+ * Internationalisation for SmilPlayer
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+$messages['en'] = array(
 12+ 'mwe-mediarss-untitled' => 'Untitled media asset'
 13+);
Property changes on: branches/MwEmbedStandAlone/modules/Playlist/MediaRss.i18n.php
___________________________________________________________________
Added: svn:eol-style
114 + native
Index: branches/MwEmbedStandAlone/modules/Playlist/README
@@ -0,0 +1,10 @@
 2+The media rss module provides basic mediaRss parsing and playlist display.
 3+
 4+It in includes a basic jquery-ui themeable gui.
 5+
 6+The main options which can be set after the kaltura javascript include:
 7+
 8+// Here are the defaults ( only layout right now )
 9+
 10+// MediaRssLayout can be "horizontal" or "vertical"
 11+mw.setConfig( 'MediaRss.Layout', 'horizontal' );
Index: branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
@@ -0,0 +1,374 @@
 2+/**
 3+* Playlist Embed. Enables the embedding of a playlist playlist using the mwEmbed player
 4+*/
 5+
 6+//Get all our message text
 7+mw.includeAllModuleMessages();
 8+
 9+mw.Playlist = function( options ){
 10+ return this.init( options );
 11+};
 12+
 13+mw.Playlist.prototype = {
 14+
 15+ // Stores the current clip index to be played
 16+ clipIndex: 0,
 17+
 18+ // Stores the cached player size:
 19+ targetPlayerSize: null,
 20+
 21+ // constructor
 22+ init: function( options ) {
 23+
 24+ this.src = options.src;
 25+
 26+ this.target = options.target;
 27+
 28+ this.id = ( options.id )? options.id : $j( this.target ).attr( 'id' );
 29+ if( !this.id ){
 30+ // Give it a random id if unset:
 31+ this.id = 'playlist_' + Math.random();
 32+ }
 33+
 34+ // Set the sourceHandler if provided
 35+ if( options.sourceHandler )
 36+ this.sourceHandler = options.sourceHandler;
 37+
 38+
 39+ this.type = ( options.type ) ?
 40+ options.type:
 41+ mw.getConfig('Playlist.defaultType' );
 42+
 43+ // Set default options or use layout
 44+ this.layout = ( options.layout ) ?
 45+ options.layout :
 46+ mw.getConfig( 'Playlist.layout' );
 47+
 48+ // Player aspect ratio
 49+ this.playerAspect = ( options.playerAspect ) ?
 50+ options.playerAspect :
 51+ mw.getConfig( 'Playlist.playerAspect' );
 52+
 53+ // Item thumb width
 54+ this.itemThumbWidth = ( options.itemThumbWidth ) ?
 55+ options.itemThumbWidth :
 56+ mw.getConfig('Playlist.itemThumbWidth');
 57+
 58+ // Default title height:
 59+ this.titleHeight = ( options.titleHeight ) ?
 60+ options.titleHeight :
 61+ mw.getConfig( 'Playlist.titleHeight' );
 62+
 63+ },
 64+
 65+ /**
 66+ * Draw the media rss playlist ui
 67+ */
 68+ drawUI: function(){
 69+ var _this = this;
 70+ // Set the target to loadingSpinner:
 71+ $j( this.target ).empty().loadingSpinner();
 72+
 73+ this.loadPlaylistHandler( function( playlistHandler ){
 74+ mw.log("mw.Playlist::loaded playlist handler");
 75+ // check if load failed or empty playlist
 76+ if( _this.sourceHandler.getClipList().length == 0 ){
 77+ $j( _this.target ).empty().text( gM('mwe-playlist-empty') )
 78+ return ;
 79+ }
 80+
 81+ // Empty the target and setup player and playerList divs
 82+ $j( _this.target )
 83+ .empty()
 84+ .append(
 85+ $j( '<span />' )
 86+ .addClass( 'media-rss-video-player')
 87+ .css({
 88+ 'float' : 'left'
 89+ })
 90+ ,
 91+ $j( '<div />')
 92+ .addClass( 'media-rss-video-list' )
 93+ .css({
 94+ 'float' : 'right',
 95+ 'overflow-y' : 'auto' ,
 96+ 'overflow-x' : 'hidden'
 97+ })
 98+ .hide()
 99+ );
 100+
 101+ // Add the selectable media list
 102+ _this.addMediaList();
 103+
 104+ // Add the player
 105+ _this.updatePlayer( _this.clipIndex, function(){
 106+ // Update the list height ( vertical layout )
 107+ if( _this.layout == 'vertical' ){
 108+ var targetListHeight = ( $j( _this.target ).height() - $j( _this.target + ' .media-rss-video-player' ).height() );
 109+ mw.log( ' targetHeight: ' + $j( _this.target ).height() + ' - ' + $j( _this.target + ' .media-rss-video-player' ).height() + ' = ' + targetListHeight );
 110+ $j( _this.target + ' .media-rss-video-list' ).css( {
 111+ 'height' : targetListHeight,
 112+ 'width' : '100%'
 113+ } ).fadeIn();
 114+ } else {
 115+ var targetListWidth = ( $j( _this.target ).width() - $j( _this.target + ' .media-rss-video-player' ).width() );
 116+ mw.log( 'targetListWidth:' + $j( _this.target ).width() + ' - pw: ' + $j( _this.target + ' .media-rss-video-player' ).width() + ' = ' + targetListWidth );
 117+ $j( _this.target + ' .media-rss-video-list').css( {
 118+ 'width' : targetListWidth,
 119+ 'height' : '100%'
 120+ } )
 121+ .fadeIn();
 122+ }
 123+ } );
 124+
 125+
 126+ });
 127+ },
 128+
 129+ /**
 130+ * Update the target size of the player
 131+ */
 132+ getTargetPlayerSize: function( ){
 133+ var _this = this;
 134+ if( this.targetPlayerSize ){
 135+ return this.targetPlayerSize;
 136+ }
 137+
 138+ // Get the target width and height: ( should be based on layout or
 139+ this.targetWidth = $j( this.target ).width();
 140+ this.targetHeight = $j( this.target ).height();
 141+
 142+ /* vertical layout */
 143+ if( _this.layout == 'vertical' ){
 144+ var pa = this.playerAspect.split(':');
 145+ this.targetPlayerSize = {
 146+ 'width' : this.targetWidth + 'px',
 147+ 'height' : parseInt( ( pa[1] / pa[0] ) * this.targetWidth )
 148+ };
 149+ } else {
 150+ /* horizontal layout */
 151+ var pa = this.playerAspect.split(':');
 152+ this.targetPlayerSize = {
 153+ 'height' : ( this.targetHeight - this.titleHeight ) + 'px',
 154+ 'width' : parseInt( ( pa[0] / pa[1] ) * this.targetHeight )
 155+ };
 156+ }
 157+ if( this.targetPlayerSize.width > this.targetWidth ){
 158+ var pa = this.playerAspect.split(':');
 159+ this.targetPlayerSize.width = this.targetWidth;
 160+ this.targetPlayerSize.height = parseInt( ( pa[1] / pa[0] ) * this.targetWidth );
 161+ }
 162+ return this.targetPlayerSize;
 163+ },
 164+
 165+ /**
 166+ * update the player
 167+ */
 168+ updatePlayer: function( clipIndex , callback ){
 169+ var _this = this;
 170+ var playerSize = _this.getTargetPlayerSize() ;
 171+
 172+ // Build and output the title
 173+ var $title = $j('<div />' )
 174+ .css( {
 175+ 'height' : _this.titleHeight,
 176+ 'font-size' : '85%',
 177+ 'width' : playerSize.width
 178+ } )
 179+ .text(
 180+ _this.sourceHandler.getClipTitle( clipIndex )
 181+ )
 182+ .addClass( 'ui-state-default ui-widget-header' )
 183+
 184+ $j( _this.target + ' .media-rss-video-player' )
 185+ .empty()
 186+ .append(
 187+ $title
 188+ );
 189+
 190+
 191+ // Update the player list if present:
 192+ $j( _this.target + ' .clipItemBlock')
 193+ .removeClass( 'ui-state-active' )
 194+ .addClass( 'ui-state-default' )
 195+ .eq( clipIndex )
 196+ .addClass( 'ui-state-active' )
 197+
 198+ // Build the video tag object:
 199+ var $video = $j( '<video />' )
 200+ .attr({
 201+ 'id' : 'mrss_' + this.id + '_' + clipIndex,
 202+ 'poster' : _this.sourceHandler.getClipPoster( clipIndex )
 203+ })
 204+ .css(
 205+ playerSize
 206+ )
 207+ // Add custom attributes:
 208+ .attr( _this.sourceHandler.getCustomClipAttributes( clipIndex ) );
 209+
 210+ // if we don't have an api based lookup ( kentryid ) lookup the sources from the
 211+ // playlist provider:
 212+ if( ! $video.attr( 'kentryid' ) ){
 213+ this.sourceHandler.getClipSources( clipIndex, function( clipSources ){
 214+
 215+ if( clipSources ){
 216+ for( var i =0; i < clipSources.length; i++ ){
 217+ var $source = $j('<source />')
 218+ .attr( clipSources[i] );
 219+ $video.append( $source );
 220+ }
 221+ }
 222+ _this.addVideoPlayer( $video , callback);
 223+ });
 224+ } else {
 225+ this.addVideoPlayer( $video , callback);
 226+ }
 227+ },
 228+
 229+ addVideoPlayer: function( $video , callback){
 230+ var _this = this;
 231+ $j( _this.target + ' .media-rss-video-player' ).append( $video );
 232+
 233+ // Update the video tag with the embedPlayer
 234+ $j.embedPlayers( function(){
 235+ // Setup ondone playing binding to play next clip
 236+ $j( '#mrss_' + _this.id + '_' + _this.clipIndex ).bind( 'ended', function(event, onDoneActionObject ){
 237+ // Play next clip
 238+ if( _this.clipIndex + 1 < _this.sourceHandler.getClipCount() ){
 239+ // Update the onDone action object to not run the base control done:
 240+ onDoneActionObject.runBaseControlDone = false;
 241+ _this.clipIndex++;
 242+
 243+ // ( if on ipad update the src and don't refresh )
 244+ _this.updatePlayer( _this.clipIndex, function(){
 245+ _this.play();
 246+ })
 247+
 248+ } else {
 249+ mw.log("Reached end of playlist run normal end action" );
 250+ // Update the onDone action object to not run the base control done:
 251+ onDoneActionObject.runBaseControlDone = true;
 252+ }
 253+ })
 254+
 255+ // Run the callback if its set
 256+ if( callback ){
 257+ callback();
 258+ }
 259+ } );
 260+ },
 261+
 262+ /**
 263+ * Add the media list with the selected clip highlighted
 264+ */
 265+ addMediaList: function() {
 266+ var _this = this;
 267+ $targetItemList = $j( this.target + ' .media-rss-video-list');
 268+
 269+ $j.each( this.sourceHandler.getClipList(), function( inx, clip ){
 270+ mw.log( 'mw.Playlist::addMediaList: On clip: ' + inx);
 271+
 272+ // Output each item with the current selected index:
 273+ $itemBlock = $j('<div />')
 274+ .addClass( 'ui-widget-content ui-corner-all' )
 275+
 276+ if( _this.clipIndex == inx ){
 277+ $itemBlock.addClass( 'ui-state-active');
 278+ } else {
 279+ $itemBlock.addClass( 'ui-state-default' );
 280+ }
 281+
 282+ // Add a single row table with image, title then duration
 283+ $itemBlock.append(
 284+ $j( '<table />')
 285+ .css( {
 286+ 'border': '0px',
 287+ 'width' : '100%'
 288+ })
 289+ .append(
 290+ $j('<tr />')
 291+ .append(
 292+ $j( '<td />')
 293+ .css('width', _this.itemThumbWidth )
 294+ .append(
 295+ $j('<img />')
 296+ .attr({
 297+ 'alt' : _this.sourceHandler.getClipTitle( inx ),
 298+ 'src' : _this.sourceHandler.getClipPoster( inx )
 299+ })
 300+ .css( 'width', _this.itemThumbWidth )
 301+ ),
 302+ $j( '<td />')
 303+ .text( _this.sourceHandler.getClipTitle( inx ) ),
 304+
 305+ $j( '<td />')
 306+ .css( 'width', '50px')
 307+ .text(
 308+ mw.seconds2npt(
 309+ _this.sourceHandler.getClipDuration( inx )
 310+ )
 311+ )
 312+
 313+ )
 314+ ) // table row
 315+ ) // table block
 316+ .data( 'clipIndex', inx )
 317+ .buttonHover()
 318+ .addClass( 'clipItemBlock' )
 319+ .css( {
 320+ 'cursor': 'pointer'
 321+ } )
 322+ .click( function(){
 323+ mw.log( 'clicked on: ' + $j( this ).data( 'clipIndex') );
 324+ // Update _this.clipIndex
 325+ _this.clipIndex = $j( this ).data( 'clipIndex' );
 326+ _this.updatePlayer( _this.clipIndex, function(){
 327+ _this.play();
 328+ } );
 329+ }) //close $itemBlock
 330+
 331+ // Add the itemBlock to the targetItem list
 332+ $targetItemList.append(
 333+ $itemBlock
 334+ )
 335+ mw.log("added item block : " + $targetItemList.children().length );
 336+ });
 337+ },
 338+
 339+ /**
 340+ * Start playback for current clip
 341+ */
 342+ play: function(){
 343+ // Get the player and play:
 344+ var vid = $j( this.target + ' .media-rss-video-player .interface_wrap').children().get(0);
 345+ if( vid && vid.play ){
 346+ vid.play();
 347+ }
 348+ },
 349+
 350+
 351+ /**
 352+ * Load the playlist driver from a source
 353+ */
 354+ loadPlaylistHandler: function( callback ){
 355+ var _this = this;
 356+ if( !_this.sourceHandler ){
 357+ switch( this.type ){
 358+ case 'application/rss+xml':
 359+ _this.sourceHandler = new mw.PlaylistHandlerMediaRss( this );
 360+ break;
 361+ }
 362+ };
 363+ // load the playlist
 364+ _this.sourceHandler.loadPlaylist( function(){
 365+ callback( _this.sourceHandler );
 366+ });
 367+ },
 368+
 369+ /**
 370+ * Set the playlsit source handler
 371+ */
 372+ setSourceHandler: function ( sourceHandler ){
 373+ this.sourceHandler = sourceHandler;
 374+ }
 375+}
Property changes on: branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
___________________________________________________________________
Added: svn:eol-style
1376 + native

Status & tagging log