Author: rgardler
Date: Fri Dec 28 23:42:34 2012
New Revision: 1426667
URL: http://svn.apache.org/viewvc?rev=1426667&view=rev
Log:
allow the album to be provided as a JSON object and improve documentation for
usage
Modified:
wookie/trunk/widgets/templates/assetPlayer/readme.txt
wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
Modified: wookie/trunk/widgets/templates/assetPlayer/readme.txt
URL:
http://svn.apache.org/viewvc/wookie/trunk/widgets/templates/assetPlayer/readme.txt?rev=1426667&r1=1426666&r2=1426667&view=diff
==============================================================================
--- wookie/trunk/widgets/templates/assetPlayer/readme.txt (original)
+++ wookie/trunk/widgets/templates/assetPlayer/readme.txt Fri Dec 28 23:42:34
2012
@@ -15,3 +15,74 @@ that build on this template (see content
- play a collection of assets in a rolling "slideshow"
- move to the next asset
- move back tot he previous asset
+ - scanning of buttons controlling the player (via the scanning template)
+
+** Use
+
+By default the asset player assumes all assets are images it is
+therefore easiest to display images using this widget. To do this all
+you need to do is set the collection that should be displayed. This is
+done by calling the setCollection(assets) method, where assets is
+either an array or an object with an "assets" property which is the
+required array. This array will contain, at least, a "src"
+property which contains the src to use for the HTML image.
+
+For example:
+
+var ${widget.shortname}_images_controller = {
+ init:function() {
+ var assets = {
+ "assets": [
+ {
+ "src":"images/places/032.jpg"
+ },
+ {
+ "src":"images/places/042.jpg"
+ },
+ {
+ "src":"images/places/eden project.jpg"
+ },
+ {
+ "src":"images/places/edenProject.jpg"
+ },
+
+ ]
+ };
+/*
+ var assets = [];
+ assets[0] = {
+ "src":"images/places/032.jpg"
+ };
+ assets[1] = {
+ "src":"images/places/042.jpg"
+ };
+*/
+
+ ${widget.shortname}_asset_controller.setCollection(assets);
+ ${widget.shortname}_scanning_controller.scanElements =
$('[data-scanOrder]');
+ },
+
+};
+
+$('#home').live('pageshow',function(event) {
+ ${widget.shortname}_images_controller.init();
+});
+
+*** Assets other than images
+
+To play assets that are not images you will also need to overwrite the
+content_primary.html file in order to provide the appropriate HTML to
+render the asset. For example, to play audio files you will use
+something like:
+
+<div>
+ <div id="player">
+ <audio id="asset" autoplay="autoplay">
+ Your browser does not support the audio tag.
+ </audio>
+ </div>
+</div>
+
+FIXME: Note that a future version of the player is likely to automaically
+create the relevant HTML tag for a chosen asset type.
+
Modified: wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
URL:
http://svn.apache.org/viewvc/wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js?rev=1426667&r1=1426666&r2=1426667&view=diff
==============================================================================
--- wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
(original)
+++ wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js Fri
Dec 28 23:42:34 2012
@@ -53,8 +53,17 @@ var ${widget.shortname}_asset_controller
});
},
+ // Set the collection to an array. The "album" should be wither an array
or an
+ // object with an assets property which is the required array.
+ //
+ // The array will contain, at least, a src property which contains the src
to
+ // use for the HTML image.
setCollection:function(album){
- ${widget.shortname}_asset_controller.collection = album;
+ if (album.assets) {
+ ${widget.shortname}_asset_controller.collection = album.assets;
+ } else {
+ ${widget.shortname}_asset_controller.collection = album;
+ }
// FIXME: cache images for faster slideshow. e.g.
http://www.anthonymclin.com/code/7-miscellaneous/98-on-demand-image-loading-with-jquery
${widget.shortname}_asset_controller.displayAsset(0);
},