|
4 | 4 | import android.os.Handler;
|
5 | 5 |
|
6 | 6 | import com.atomjack.shared.Logger;
|
| 7 | +import com.atomjack.shared.NewLogger; |
7 | 8 | import com.atomjack.shared.PlayerState;
|
8 | 9 | import com.atomjack.shared.model.Timeline;
|
9 | 10 | import com.atomjack.vcfp.interfaces.PlexMediaHandler;
|
|
41 | 42 | import java.util.regex.Pattern;
|
42 | 43 |
|
43 | 44 | public class PlexSubscription {
|
| 45 | + private NewLogger logger; |
44 | 46 | private static final int SUBSCRIBE_INTERVAL = 30000; // Send subscribe message every 30 seconds to keep us alive
|
45 | 47 |
|
46 | 48 | private static Serializer serial = new Persister();
|
@@ -74,6 +76,7 @@ public class PlexSubscription {
|
74 | 76 |
|
75 | 77 | public PlexSubscription() {
|
76 | 78 | mHandler = new Handler();
|
| 79 | + logger = new NewLogger(this); |
77 | 80 | }
|
78 | 81 |
|
79 | 82 | public void setListener(PlexSubscriptionListener _listener) {
|
@@ -472,13 +475,15 @@ public void onSuccess(MediaContainer playlistMediaContainer) {
|
472 | 475 | if(media != null) {
|
473 | 476 | if(nowPlayingMedia != null) // if we're already playing media, this new media we found is different, so notify the listener
|
474 | 477 | listener.onMediaChanged(media, PlayerState.getState(timeline));
|
475 |
| - else |
| 478 | + else if(currentState != PlayerState.STOPPED){ // edge case where we receive a new timeline with a state of stopped after this one, but before this one has finished processing |
476 | 479 | listener.onPlayStarted(media, nowPlayingPlaylist, PlayerState.getState(timeline));
|
| 480 | + } |
477 | 481 | } else {
|
478 | 482 | // TODO: Handle not finding any media?
|
479 | 483 | }
|
480 | 484 | nowPlayingMedia = media;
|
481 |
| - VoiceControlForPlexApplication.getInstance().setNotification(mClient, currentState, nowPlayingMedia, nowPlayingPlaylist); |
| 485 | + if(currentState != PlayerState.STOPPED) |
| 486 | + VoiceControlForPlexApplication.getInstance().setNotification(mClient, currentState, nowPlayingMedia, nowPlayingPlaylist); |
482 | 487 | }
|
483 | 488 |
|
484 | 489 | @Override
|
|
0 commit comments