Initial Flash and HTML5 audio contexts
This commit is contained in:
@@ -10,9 +10,9 @@ import lime.media.WebAudioContext;
|
|||||||
enum AudioContext {
|
enum AudioContext {
|
||||||
|
|
||||||
OPENAL (al:ALAudioContext);
|
OPENAL (al:ALAudioContext);
|
||||||
HTML5 (audio:HTML5AudioContext);
|
HTML5 (context:HTML5AudioContext);
|
||||||
WEB (context:WebAudioContext);
|
WEB (context:WebAudioContext);
|
||||||
FLASH (sound:FlashRenderContext);
|
FLASH (context:FlashAudioContext);
|
||||||
CUSTOM (data:Dynamic);
|
CUSTOM (data:Dynamic);
|
||||||
|
|
||||||
}
|
}
|
||||||
32
lime/media/AudioSource.hx
Normal file
32
lime/media/AudioSource.hx
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package lime.media;
|
||||||
|
|
||||||
|
|
||||||
|
#if js
|
||||||
|
import js.html.Audio;
|
||||||
|
#elseif flash
|
||||||
|
import flash.media.Sound;
|
||||||
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
class AudioSource {
|
||||||
|
|
||||||
|
|
||||||
|
public var id:Int;
|
||||||
|
|
||||||
|
#if js
|
||||||
|
public var src:Audio;
|
||||||
|
#elseif flash
|
||||||
|
public var src:Sound;
|
||||||
|
#else
|
||||||
|
public var src:Dynamic;
|
||||||
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
public function new () {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
package lime.media; #if !flash
|
package lime.media;
|
||||||
|
import openfl.utils.UInt;
|
||||||
|
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
import flash.media.Sound;
|
||||||
|
#end
|
||||||
|
|
||||||
|
|
||||||
class FlashAudioContext {
|
class FlashAudioContext {
|
||||||
|
|
||||||
|
|
||||||
// Need to come up with an API that allows for management of multiple Sound instances?
|
|
||||||
|
|
||||||
|
|
||||||
public function new () {
|
public function new () {
|
||||||
|
|
||||||
|
|
||||||
@@ -14,9 +17,204 @@ class FlashAudioContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
public function createSource (stream:Dynamic /*URLRequest*/ = null, context:Dynamic /*SoundLoaderContext*/ = null):AudioSource {
|
||||||
|
|
||||||
|
#if flash
|
||||||
#else
|
var source = new AudioSource ();
|
||||||
typedef FlashAudioContext = flash.media.Sound;
|
source.src = new Sound (stream, context);
|
||||||
#end
|
return source;
|
||||||
|
#else
|
||||||
|
return null;
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getBytesLoaded (source:AudioSource):UInt {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.bytesLoaded;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getBytesTotal (source:AudioSource):Int {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.bytesTotal;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getID3 (source:AudioSource):Dynamic /*ID3Info*/ {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.id3;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getIsBuffering (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.isBuffering;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getIsURLInaccessible (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.isURLInaccessible;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getLength (source:AudioSource):Float {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.length;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getURL (source:AudioSource):String {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.url;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function close (source:AudioSource):Void {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.close ();
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function extract (source:AudioSource, target:Dynamic /*flash.utils.ByteArray*/, length:Float, startPosition:Float = -1):Float {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.extract (target, length, startPosition);
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function load (source:AudioSource, stream:Dynamic /*flash.net.URLRequest*/, context:Dynamic /*SoundLoaderContext*/ = null):Void {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.load (stream, context);
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function loadCompressedDataFromByteArray (source:AudioSource, bytes:Dynamic /*flash.utils.ByteArray*/, bytesLength:UInt):Void {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.loadCompressedDataFromByteArray (bytes, bytesLength);
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function loadPCMFromByteArray (source:AudioSource, bytes:Dynamic /*flash.utils.ByteArray*/, samples:UInt, format:String = null, stereo:Bool = true, sampleRate:Float = 44100):Void {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.loadPCMFromByteArray (bytes, samples, format, stereo, sampleRate);
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function play (source:AudioSource, startTime:Float = 0, loops:Int = 0, sndTransform:Dynamic /*SoundTransform*/ = null):Dynamic /*SoundChannel*/ {
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.play (startTime, loops, sndTransform);
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,23 @@
|
|||||||
package lime.media; #if !js
|
package lime.media;
|
||||||
|
|
||||||
|
|
||||||
|
#if js
|
||||||
|
import js.html.Audio;
|
||||||
|
#end
|
||||||
|
|
||||||
|
|
||||||
class HTML5AudioContext {
|
class HTML5AudioContext {
|
||||||
|
|
||||||
|
|
||||||
// Need to come up with an API that allows for management of multiple Audio instances?
|
public inline var HAVE_CURRENT_DATA:Int = 2;
|
||||||
|
public inline var HAVE_ENOUGH_DATA:Int = 4;
|
||||||
|
public inline var HAVE_FUTURE_DATA:Int = 3;
|
||||||
|
public inline var HAVE_METADATA:Int = 1;
|
||||||
|
public inline var HAVE_NOTHING:Int = 0;
|
||||||
|
public inline var NETWORK_EMPTY:Int = 0;
|
||||||
|
public inline var NETWORK_IDLE:Int = 1;
|
||||||
|
public inline var NETWORK_LOADING:Int = 2;
|
||||||
|
public inline var NETWORK_NO_SOURCE:Int = 3;
|
||||||
|
|
||||||
|
|
||||||
public function new () {
|
public function new () {
|
||||||
@@ -14,9 +27,589 @@ class HTML5AudioContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
public function canPlayType (source:AudioSource, type:String):String {
|
||||||
|
|
||||||
|
#if js
|
||||||
#else
|
if (source.src != null) {
|
||||||
typedef HTML5AudioContext = js.html.Audio;
|
|
||||||
#end
|
return source.src.canPlayType (type);
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function createSource (urlString:String = null):AudioSource {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
var source = new AudioSource ();
|
||||||
|
source.src = new Audio (urlString);
|
||||||
|
return source;
|
||||||
|
#else
|
||||||
|
return null;
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getAudioDecodedByteCount (source:AudioSource):Int {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.audioDecodedByteCount;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getAutoplay (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.autoplay;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getBuffered (source:AudioSource):Dynamic /*TimeRanges*/ {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.buffered;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getController (source:AudioSource):Dynamic /*MediaController*/ {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.controller;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCurrentSrc (source:AudioSource):String {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.currentSrc;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCurrentTime (source:AudioSource):Float {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.currentTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getDefaultPlaybackRate (source:AudioSource):Float {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.defaultPlaybackRate;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getDuration (source:AudioSource):Float {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.duration;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getEnded (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.ended;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getError (source:AudioSource):Dynamic /*MediaError*/ {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.error;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getInitialTime (source:AudioSource):Float {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.initialTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getLoop (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.loop;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getMediaGroup (source:AudioSource):String {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.mediaGroup;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getMuted (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.muted;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getNetworkState (source:AudioSource):Int {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.networkState;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getPaused (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.paused;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getPlaybackRate (source:AudioSource):Float {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.playbackRate;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getPlayed (source:AudioSource):Dynamic /*TimeRanges*/ {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.played;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getPreload (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.preload;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getReadyState (source:AudioSource):Int {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.readyState;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getSeekable (source:AudioSource):Dynamic /*TimeRanges*/ {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.seekable;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getSeeking (source:AudioSource):Bool {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.seeking;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getSrc (source:AudioSource):String {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.src;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getStartTime (source:AudioSource):Float {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.playbackRate;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getVolume (source:AudioSource):Float {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.volume;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function load (source:AudioSource):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.load ();
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function pause (source:AudioSource):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.pause ();
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function play (source:AudioSource):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
return source.src.play ();
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setAutoplay (source:AudioSource, value:Bool):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.autoplay = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setController (source:AudioSource, value:Dynamic /*MediaController*/):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.controller = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setCurrentTime (source:AudioSource, value:Float):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.currentTime = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setDefaultPlaybackRate (source:AudioSource, value:Float):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.defaultPlaybackRate = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setLoop (source:AudioSource, value:Bool):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.loop = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setMediaGroup (source:AudioSource, value:String):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.mediaGroup = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setMuted (source:AudioSource, value:Bool):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.muted = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setPlaybackRate (source:AudioSource, value:Float):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.playbackRate = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setPreload (source:AudioSource, value:Bool):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.preload = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setSrc (source:AudioSource, value:String):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.src = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setVolume (source:AudioSource, value:Float):Void {
|
||||||
|
|
||||||
|
#if js
|
||||||
|
if (source.src != null) {
|
||||||
|
|
||||||
|
source.src.volume = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user