{"action":"created","issue":{"url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/159","repository_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient","labels_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/159/labels{/name}","comments_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/159/comments","events_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/159/events","html_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/159","id":131966413,"number":159,"title":"Avoid polling for current track and time changes.","user":{"login":"jcass77","id":10268911,"avatar_url":"https://avatars.githubusercontent.com/u/10268911?v=3","gravatar_id":"","url":"https://api.github.com/users/jcass77","html_url":"https://github.com/jcass77","followers_url":"https://api.github.com/users/jcass77/followers","following_url":"https://api.github.com/users/jcass77/following{/other_user}","gists_url":"https://api.github.com/users/jcass77/gists{/gist_id}","starred_url":"https://api.github.com/users/jcass77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcass77/subscriptions","organizations_url":"https://api.github.com/users/jcass77/orgs","repos_url":"https://api.github.com/users/jcass77/repos","events_url":"https://api.github.com/users/jcass77/events{/privacy}","received_events_url":"https://api.github.com/users/jcass77/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-02-07T13:10:14Z","updated_at":"2016-02-07T19:12:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/pulls/159","html_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/159","diff_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/159.diff","patch_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/159.patch"},"body":"Based on the work done by @wagamama and @adamcik.\r\n\r\n- Replaces existing track slider timer with @adamcik's [media-progress-timer](https://github.com/adamcik/media-progress-timer).\r\n\r\n- Checks to ensure that the timer is in sync with ``mopidy.playback.getTimePosition()``. This is useful for streams that take a long time to buffer. Ideally, Mopidy should have an audio listener that triggers an event when the buffer has been filled and gstreamer actually starts to play the track?\r\n\r\n- Removes reliance on ``updateStatusTimer`` for polling Mopidy to check the status of the currently playing track and playback position.\r\n\r\nFixes #40, replaces #95."},"comment":{"url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/comments/181087639","html_url":"https://github.com/pimusicbox/mopidy-musicbox-webclient/pull/159#issuecomment-181087639","issue_url":"https://api.github.com/repos/pimusicbox/mopidy-musicbox-webclient/issues/159","id":181087639,"user":{"login":"jcass77","id":10268911,"avatar_url":"https://avatars.githubusercontent.com/u/10268911?v=3","gravatar_id":"","url":"https://api.github.com/users/jcass77","html_url":"https://github.com/jcass77","followers_url":"https://api.github.com/users/jcass77/followers","following_url":"https://api.github.com/users/jcass77/following{/other_user}","gists_url":"https://api.github.com/users/jcass77/gists{/gist_id}","starred_url":"https://api.github.com/users/jcass77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcass77/subscriptions","organizations_url":"https://api.github.com/users/jcass77/orgs","repos_url":"https://api.github.com/users/jcass77/repos","events_url":"https://api.github.com/users/jcass77/events{/privacy}","received_events_url":"https://api.github.com/users/jcass77/received_events","type":"User","site_admin":false},"created_at":"2016-02-07T19:12:05Z","updated_at":"2016-02-07T19:12:05Z","body":"I couldn't pick up the glitch at 100ms but setting it to 1000ms: yes, that is more or less the animation effect that I am trying to avoid. On a conceptual level, what I am aiming for is (assuming that the user is playing a stream that takes 5-10 seconds to buffer on every seek):\r\n\r\n1. Mopidy playback starts and triggers ```playbackStateChanged```, which starts the timer.\r\n2. Instead of progressing the slider immediately, the timer callback starts doing ```mopidy.playback.getTimePosition()``` until the position moves off zero.\r\n3. The callback now starts progressing the slider, and should in theory be in sync with Mopidy's position.\r\n\r\nDoing a seek by dragging the slider should work in a similar way as the above:\r\n\r\n1. User drags the slider, and  ``ui.value`` (or ``$(this).val()``?) should contain the target position value.\r\n2. ``mopidy.playback.seek(ui.value)`` is called to perform the seek.\r\n3. The timer does the callback and waits for ```mopidy.playback.getTimePosition()``` to match whatever ``ui.value`` returned before progressing the slider.\r\n\r\nIn practice it doesn't appear to be working at all unfortunately. The results that I am getting with ``mopidy.playback.getTimePosition()`` seem a little unpredictable between track changes (probably because I am not using the promise correctly). So the slider always moves off zero and then glitches back once the track audio actually starts."}}