Changeset 11397 in josm for trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
- Timestamp:
- 2016-12-14T15:50:53+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r11100 r11397 124 124 */ 125 125 public static void play(URL url) throws Exception { 126 AudioPlayer.getInstance().command.play(url, 0.0, 1.0); 126 AudioPlayer instance = AudioPlayer.getInstance(); 127 if (instance != null) 128 instance.command.play(url, 0.0, 1.0); 127 129 } 128 130 … … 134 136 */ 135 137 public static void play(URL url, double seconds) throws Exception { 136 AudioPlayer.getInstance().command.play(url, seconds, 1.0); 138 AudioPlayer instance = AudioPlayer.getInstance(); 139 if (instance != null) 140 instance.command.play(url, seconds, 1.0); 137 141 } 138 142 … … 145 149 */ 146 150 public static void play(URL url, double seconds, double speed) throws Exception { 147 AudioPlayer.getInstance().command.play(url, seconds, speed); 151 AudioPlayer instance = AudioPlayer.getInstance(); 152 if (instance != null) 153 instance.command.play(url, seconds, speed); 148 154 } 149 155 … … 153 159 */ 154 160 public static void pause() throws Exception { 155 AudioPlayer.getInstance().command.pause(); 161 AudioPlayer instance = AudioPlayer.getInstance(); 162 if (instance != null) 163 instance.command.pause(); 156 164 } 157 165 … … 161 169 */ 162 170 public static URL url() { 163 return AudioPlayer.getInstance().playingUrl; 171 AudioPlayer instance = AudioPlayer.getInstance(); 172 return instance == null ? null : instance.playingUrl; 164 173 } 165 174 … … 169 178 */ 170 179 public static boolean paused() { 171 return AudioPlayer.getInstance().state == State.PAUSED; 180 AudioPlayer instance = AudioPlayer.getInstance(); 181 return instance == null ? false : (instance.state == State.PAUSED); 172 182 } 173 183 … … 177 187 */ 178 188 public static boolean playing() { 179 return AudioPlayer.getInstance().state == State.PLAYING; 189 AudioPlayer instance = AudioPlayer.getInstance(); 190 return instance == null ? false : (instance.state == State.PLAYING); 180 191 } 181 192 … … 185 196 */ 186 197 public static double position() { 187 return AudioPlayer.getInstance().position; 198 AudioPlayer instance = AudioPlayer.getInstance(); 199 return instance == null ? -1 : instance.position; 188 200 } 189 201 … … 193 205 */ 194 206 public static double speed() { 195 return AudioPlayer.getInstance().speed; 207 AudioPlayer instance = AudioPlayer.getInstance(); 208 return instance == null ? -1 : instance.speed; 196 209 } 197 210
Note:
See TracChangeset
for help on using the changeset viewer.