示例#1
0
 public PersistentBeamPlaylist(PimpSession session, PimpWebSocket webSocket, BeamPlayer player)
     : base(session, webSocket, player)
 {
     fileName                = session.Username + ".json";
     webSocket.Welcomed     += webSocket_Welcomed;
     webSocket.Disconnected += PlayerDisconnected;
 }
示例#2
0
 public WebSocketPlaylistBase(PimpWebSocket webSocket)
 {
     this.webSocket                  = webSocket;
     IsEventBased                    = true;
     AutoPlay                        = true;
     webSocket.PlaylistModified     += Sync;
     webSocket.PlaylistIndexChanged += index => Index = index;
 }
 public TimeBasedPlaylist(PimpWebSocket webSocket)
 {
     this.webSocket                  = webSocket;
     StartedFromSeconds              = 0;
     AutoPlay                        = true;
     webSocket.PlaylistModified     += Sync;
     webSocket.PlaylistIndexChanged += index => Index = index;
     webSocket.TimeUpdated          += webSocket_TimeUpdated;
 }
示例#4
0
 private Task UpdateShortStatus(ShortStatusJsonEvent ev)
 {
     return(OnUiThread(() => {
         CurrentPlayerState = PimpWebSocket.FromName(ev.state);
         TrackPosition = TimeSpan.FromSeconds(ev.position);
         Volume = ev.volume;
         IsMute = ev.mute;
     }));
 }
示例#5
0
        public BeamPlayer(PimpSession session, PimpWebSocket webSocket, CoverService coverService)
            : base(session, webSocket)
        {
            IsSkipAndSeekSupported = false;

            Volume = 100;
            IsMute = false;

            webSocket.Welcomed     += webSocket_Welcomed;
            webSocket.Disconnected += webSocket_Disconnected;

            TrackChanged += BeamPlayer_TrackChanged;
        }
示例#6
0
        public WebSocketPlayer(SimplePimpSession session, PimpWebSocket webSocket)
        {
            Session        = session;
            this.webSocket = webSocket;
            this.session   = session;
            // the lifetime of this player is the same as the websocket
            // so we don't care about deregistering event handlers
            // Update: I believe the above is untrue.
            webSocket.MuteToggled += async muteOrNot => await OnUiThread(() => IsMute = muteOrNot);

            webSocket.VolumeChanged += async volume => await OnUiThread(() => Volume = volume);

            webSocket.TimeUpdated  += OnTimeUpdated;
            webSocket.TrackChanged += async track => {
                // TODO do better
                FeedbackMessage = null;
                await OnUiThread(() => NowPlaying = track);
            };
            webSocket.PlayStateChanged += async state => await OnUiThread(() => CurrentPlayerState = state);

            webSocket.StatusUpdateReceived      += UpdateStatus;
            webSocket.ShortStatusUpdateReceived += async shortStatus => await UpdateShortStatus(shortStatus);

            webSocket.Welcomed += async() => {
                await OnUiThread(() => IsOnline = true);

                await Utils.SuppressAsync <Exception>(async() => await PostSimple("status"));
            };
            //webSocket.Disconnected += str => IsOnline = false;
            webSocket.SocketClosed += async str => {
                await OnUiThread(() => IsOnline = false);

                // Tries to reconnect, once
                await Utils.SuppressAsync <Exception>(OpenWebSocketAsync);
            };
            webSocket.ErrorOccurred += async() => await OnUiThread(() => IsOnline = false);

            IsEventBased = true;
        }
示例#7
0
 public PhoneBeamPlayer(PimpSession session, PimpWebSocket webSocket)
     : base(session, webSocket, PhoneCoverService.Instance)
 {
     BeamPlaylist = new PhoneBeamPlaylist(session, webSocket, this);
     Init();
 }
示例#8
0
 public PimpPlayer(PimpSession s, Func <MusicEndpoint> musicSource, PimpWebSocket webSocket)
     : this(s, webSocket, new PimpPlaylist(s, musicSource, webSocket))
 {
 }
示例#9
0
        //public static readonly string postResource = "/playback";

        public PimpPlayer(SimplePimpSession s, PimpWebSocket webSocket, BasePlaylist playlist)
            : base(s, webSocket)
        {
            Playlist = playlist;
        }
示例#10
0
 public PimpWebPlayer(PimpSession session, PimpWebSocket webSocket)
     : base(session, webSocket)
 {
     Playlist = new PimpWebPlaylist(session, webSocket);
 }
示例#11
0
 public BasePlayer NewBeamPlayer(PimpSession session, PimpWebSocket socket)
 {
     return(impl.NewBeamPlayer(session, socket));
 }
示例#12
0
 public PimpPlaylist(PimpSession session, Func <MusicEndpoint> musicSource, PimpWebSocket webSocket)
     : base(session, webSocket)
 {
     this.s           = session;
     this.musicSource = musicSource;
 }
示例#13
0
 public StoreBeamPlaylist(PimpSession session, PimpWebSocket webSocket, BeamPlayer player)
     : base(session, webSocket, player)
 {
     roaming = new RoamingSettings();
 }
示例#14
0
 public BeamPlaylist(PimpSession session, PimpWebSocket webSocket, BeamPlayer player)
     : base(webSocket)
 {
     this.session = session;
     this.player  = player;
 }
示例#15
0
 public PimpBasePlayer(SimplePimpSession session, PimpWebSocket pimpSocket)
     : base(session, pimpSocket)
 {
 }
示例#16
0
 private static PlayerState playerState(StatusPimpResponse status)
 {
     return(PimpWebSocket.FromName(status.state));
 }
 public SimplePimpPlaylist(SimplePimpSession session, PimpWebSocket webSocket)
     : base(webSocket)
 {
     this.session = session;
 }
示例#18
0
 public PimpWebPlaylist(PimpSessionBase session, PimpWebSocket webSocket)
     : base(webSocket)
 {
     this.session = session;
 }
示例#19
0
 public PhoneBeamPlaylist(PimpSession session, PimpWebSocket webSocket, BeamPlayer player)
     : base(session, webSocket, player)
 {
 }