1/*
2 * jPlayer Plugin for jQuery JavaScript Library
3 * http://www.jplayer.org
4 *
5 * Copyright (c) 2009 - 2014 Happyworm Ltd
6 * Licensed under the MIT license.
7 * http://opensource.org/licenses/MIT
8 *
9 * Author: Mark J Panaghiston
10 * Date: 27th November 2014
11 */
12
13package happyworm.jPlayer {
14	public class JplayerStatus {
15
16		public static const VERSION:String = "2.9.0"; // The version of the Flash jPlayer entity.
17
18		public var volume:Number = 0.5; // Not affected by reset()
19		public var muted:Boolean = false; // Not affected by reset()
20
21		public var src:String;
22		public var srcError:Boolean;
23
24		public var srcSet:Boolean;
25		public var isPlaying:Boolean;
26		public var isSeeking:Boolean;
27
28		public var isWaiting:Boolean;
29
30		public var playOnLoad:Boolean;
31		public var playOnSeek:Boolean;
32
33		public var isStartingDownload:Boolean;
34		public var isLoading:Boolean;
35		public var isLoaded:Boolean;
36
37		public var pausePosition:Number;
38
39		public var seekPercent:Number;
40		public var currentTime:Number;
41		public var currentPercentRelative:Number;
42		public var currentPercentAbsolute:Number;
43		public var duration:Number;
44
45		public var videoWidth:Number;
46		public var videoHeight:Number;
47
48		public var metaDataReady:Boolean;
49		public var metaData:Object;
50
51		public function JplayerStatus() {
52			reset();
53		}
54		public function reset():void {
55			src = "";
56			srcError = false;
57
58			srcSet = false;
59			isPlaying = false;
60			isSeeking = false;
61
62			isWaiting = false;
63
64			playOnLoad = false;
65			playOnSeek = false;
66
67			isStartingDownload = false;
68			isLoading = false;
69			isLoaded = false;
70
71			pausePosition = 0;
72
73			seekPercent = 0;
74			currentTime = 0;
75			currentPercentRelative = 0;
76			currentPercentAbsolute = 0;
77			duration = 0;
78
79			videoWidth = 0;
80			videoHeight = 0;
81
82			metaDataReady = false;
83			metaData = {};
84		}
85		public function error():void {
86			var srcSaved:String = src;
87			reset();
88			src = srcSaved;
89			srcError = true;
90		}
91		public function loadRequired():Boolean {
92			return (srcSet && !isStartingDownload && !isLoading && !isLoaded);
93		}
94		public function startingDownload():void {
95			isStartingDownload = true;
96			isLoading = false;
97			isLoaded = false;
98		}
99		public function loading():void {
100			isStartingDownload = false;
101			isLoading = true;
102			isLoaded = false;
103		}
104		public function loaded():void {
105			isStartingDownload = false;
106			isLoading = false;
107			isLoaded = true;
108		}
109	}
110}
111