1 // ==========================================================================
  2 // Project:   SproutCore - JavaScript Application Framework
  3 // Copyright: ©2006-2011 Strobe Inc. and contributors.
  4 //            Portions ©2008-2011 Apple Inc. All rights reserved.
  5 // License:   Licensed under MIT license (see license.js)
  6 // ==========================================================================
  7 /*globals SC */
  8 
  9 sc_require('views/media_slider');
 10 /** @class
 11   @extends SC.View
 12 */
 13 SC.SimpleMediaControlsView = SC.View.extend(
 14 /** @scope SC.SimpleMediaControlsView.prototype */{
 15 
 16   target: null,
 17 
 18   childViews: ['playButton', 'progressView'],
 19 
 20   classNames: ['sc-media-controls'],
 21 
 22   playObserver: function(){
 23     if(this.getPath('target.paused')){
 24       this.get('playButton').set('icon', 'play');
 25     }else{
 26       this.get('playButton').set('icon', 'stop');
 27     }
 28   }.observes('*target.paused'),
 29 
 30   playButton: SC.ButtonView.design({
 31     title: '',
 32     titleMinWidth: 35,
 33     icon: 'play',
 34     layout: { top: 0, left: 0, width: 20, height:20 },
 35     action: "playPause",
 36     targetBinding: ".parentView.target"
 37   }),
 38 
 39   progressView: SC.MediaSlider.design({
 40     layout: { top: 0, left: 25, right: 10, height:20 },
 41     value:0,
 42     minimum: 0,
 43     step:0.1,
 44     valueBinding: ".parentView*target.currentTime" ,
 45     maximumBinding: ".parentView*target.duration",
 46     mediaViewBinding: ".parentView.target"
 47   })
 48 });
 49