diff --git a/src/flash/FlashMediaElement.as b/src/flash/FlashMediaElement.as index 75d92cdaa..2fe83aca9 100644 --- a/src/flash/FlashMediaElement.as +++ b/src/flash/FlashMediaElement.as @@ -33,6 +33,7 @@ private var _enableSmoothing:Boolean; private var _allowedPluginDomain:String; private var _isFullScreen:Boolean = false; + private var _startVolume:Number; // native video size (from meta data) private var _nativeVideoWidth:Number = 0; @@ -75,6 +76,7 @@ _timerRate = (params['timerrate'] != undefined) ? (parseInt(params['timerrate'], 10)) : 250; _showControls = (params['controls'] != undefined) ? (String(params['controls']) == "true") : false; _enableSmoothing = (params['smoothing'] != undefined) ? (String(params['smoothing']) == "true") : false; + _startVolume = (params['startvolume'] != undefined) ? (parseInt(params['startvolume'], 10)) : 1; if (isNaN(_timerRate)) _timerRate = 250; @@ -104,7 +106,7 @@ // create media element if (_isVideo) { - _mediaElement = new VideoElement(this, _autoplay, _timerRate); + _mediaElement = new VideoElement(this, _autoplay, _timerRate, _startVolume); _video = (_mediaElement as VideoElement).video; _video.width = _stageWidth; _video.height = _stageHeight; @@ -112,7 +114,7 @@ //_video.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO; addChild(_video); } else { - _mediaElement = new AudioElement(this, _autoplay, _timerRate); + _mediaElement = new AudioElement(this, _autoplay, _timerRate, _startVolume); } // debugging diff --git a/src/flash/htmlelements/AudioElement.as b/src/flash/htmlelements/AudioElement.as index 74a613dfe..0588b0428 100644 --- a/src/flash/htmlelements/AudioElement.as +++ b/src/flash/htmlelements/AudioElement.as @@ -54,15 +54,16 @@ package htmlelements return _currentTime; } - public function AudioElement(element:FlashMediaElement, autoplay:Boolean, timerRate:Number) + public function AudioElement(element:FlashMediaElement, autoplay:Boolean, timerRate:Number, startVolume:Number) { _element = element; _autoplay = autoplay; + _volume = startVolume; _timer = new Timer(timerRate); _timer.addEventListener(TimerEvent.TIMER, timerEventHandler); - _soundTransform = new SoundTransform(); + _soundTransform = new SoundTransform(_volume); _soundLoaderContext = new SoundLoaderContext(); } diff --git a/src/flash/htmlelements/VideoElement.as b/src/flash/htmlelements/VideoElement.as index fb22f9b2d..43b90deed 100644 --- a/src/flash/htmlelements/VideoElement.as +++ b/src/flash/htmlelements/VideoElement.as @@ -77,10 +77,11 @@ // _stream gets created - public function VideoElement(element:FlashMediaElement, autoplay:Boolean, timerRate:Number) + public function VideoElement(element:FlashMediaElement, autoplay:Boolean, timerRate:Number, startVolume:Number) { _element = element; _autoplay = autoplay; + _volume = startVolume; _video = new Video(); addChild(_video); diff --git a/src/js/me-shim.js b/src/js/me-shim.js index 77b70acf6..b61c27b6a 100644 --- a/src/js/me-shim.js +++ b/src/js/me-shim.js @@ -343,6 +343,7 @@ mejs.HtmlMediaElementShim = { 'autoplay=' + ((autoplay) ? "true" : "false"), 'preload=' + preload, 'width=' + width, + 'startvolume=' + options.startVolume, 'timerrate=' + options.timerRate, 'height=' + height]; diff --git a/src/silverlight/MainPage.xaml.cs b/src/silverlight/MainPage.xaml.cs index a3d33ca09..ca4b581ee 100644 --- a/src/silverlight/MainPage.xaml.cs +++ b/src/silverlight/MainPage.xaml.cs @@ -34,6 +34,7 @@ public partial class MainPage : UserControl int _timerRate = 0; double _bufferedBytes = 0; double _bufferedTime = 0; + double _volume = 1; int _videoWidth = 0; int _videoHeight = 0; @@ -74,6 +75,8 @@ public MainPage(IDictionary initParams) Int32.TryParse(initParams["height"], out _height); if (initParams.ContainsKey("timerate")) Int32.TryParse(initParams["timerrate"], out _timerRate); + if (initParams.ContainsKey("startvolume")) + Double.TryParse(initParams["startvolume"], out _volume); if (_timerRate == 0) _timerRate = 250; @@ -101,6 +104,7 @@ public MainPage(IDictionary initParams) media.AutoPlay = _autoplay; + media.Volume = _volume; if (!String.IsNullOrEmpty(_mediaUrl)) { setSrc(_mediaUrl); if (_autoplay)