diff --git a/src/com/sprintpcs/media/Player.java b/src/com/sprintpcs/media/Player.java index a9cec150..68a31678 100644 --- a/src/com/sprintpcs/media/Player.java +++ b/src/com/sprintpcs/media/Player.java @@ -56,7 +56,7 @@ public static void play(Clip clip, int repeat) try { player.start(); - listener.playerUpdate(PlayerListener.STARTED, player.getMediaTime()); + if(listener != null) { listener.playerUpdate(PlayerListener.STARTED, player.getMediaTime()); } } catch (Exception e) { Mobile.log(Mobile.LOG_WARNING, Player.class.getPackage().getName() + "." + Player.class.getSimpleName() + ": " + "failed to play Clip media: " + e.getMessage()); } } @@ -86,7 +86,7 @@ public static void play(DualTone dTone, int repeat) // I assume the second argum try { player.start(); - listener.playerUpdate(PlayerListener.STARTED, player.getMediaTime()); + if(listener != null) { listener.playerUpdate(PlayerListener.STARTED, player.getMediaTime()); } } catch (Exception e) { @@ -94,7 +94,11 @@ public static void play(DualTone dTone, int repeat) // I assume the second argum } } - public static void resume() { player.start(); } + public static void resume() + { + player.start(); + if(listener != null) { listener.playerUpdate(PlayerListener.STARTED, player.getMediaTime()); } + } public static void addPlayerListener(PlayerListener playerListener) { listener = playerListener; } @@ -105,7 +109,7 @@ public static void stop() if (player != null) { player.stop(); - listener.playerUpdate(PlayerListener.STOPPED, player.getMediaTime()); + if(listener != null) { listener.playerUpdate(PlayerListener.STOPPED, player.getMediaTime()); } } } } \ No newline at end of file