kalkih / mini-media-player

Minimalistic media card for Home Assistant Lovelace UI
MIT License
1.52k stars 207 forks source link

Progress of paused player increases on tab refresh or Lovelace view switch #346

Closed BoOmka closed 3 years ago

BoOmka commented 4 years ago

When the player is paused, its progress is increasing whenever I refresh HA tab or switch to another lovelace view by amount of seconds which the player spent out of view.

ezgif com-video-to-gif (1) Gif explanation:

  1. Current position is "41:40", according to card (00:06 in reality), media_player is in "paused" state
  2. I switch to another lovelace view, wait a couple of seconds and return back
  3. New position is "41:51", but media_player is still paused at 00:06
  4. Starting player continues wrong timer, but pausing it resets the timer to actual true value. media_position and media_position_updated_at are updated on pause for Kodi

Relevant media_player entity attributes:

media_duration: 8078
media_position: 6
media_position_updated_at: 2020-07-02T15:31:38.452271+00:00

The issue persists for another player as well (custom one).

kalkih commented 4 years ago

Hello, Thanks for the detailed explanation.

Can you provide some more data of the attributes One snapshot of the attributes just before pausing and one just after pausing (when the issue is present).

Thanks!

BoOmka commented 4 years ago

Sure! I have two players and both are having more or less the same issue but are behaving a bit differently:

Kodi - while paused, progress bar and time increase each time I refresh tab or switch view by respective amount of seconds; - after pressing "play" timer bar start from last position (wrong one); - after pressing "pause" timer and bar reset to real positions. After play (note that `media_position_updated_at` is dated yesterday — the time I last pressed pause): ```json { "volume_level": "0.68", "is_volume_muted": false, "media_content_type": "video", "media_duration": 8078, "media_position": 34, "media_position_updated_at": "2020-07-02T21:24:38.004309+00:00", "media_title": "blah-blah.avi", "media_album_name": "", "media_series_title": "", "media_season": "-1", "media_episode": "-1", "friendly_name": "Kodi", "entity_picture": "/api/media_player_proxy/media_player.kodi?token=xxxxxxx&cache=xxxxxxxxxxxxxxxx", "supported_features": "54847", "icon": "mdi:kodi" } ``` After pause: ```json { "volume_level": "0.68", "is_volume_muted": false, "media_content_type": "video", "media_duration": 8078, "media_position": 178, "media_position_updated_at": "2020-07-03T09:18:27.531938+00:00", "media_title": "blah-blah.avi", "media_album_name": "", "media_series_title": "", "media_season": "-1", "media_episode": "-1", "friendly_name": "Kodi", "entity_picture": "/api/media_player_proxy/media_player.kodi?token=xxxxxxx&cache=xxxxxxxxxxxxxxxx", "supported_features": "54847", "icon": "mdi:kodi" } ```
Yandex Station - while paused, progress bar and time increase each time I refresh tab or switch view by respective amount of seconds; - after pressing "play" timer and bar reset to real positions and behave normally; - after pressing "pause" timer and bar stop just to be shifted again on next refresh/view switch. After play (at this time `media_position_updated_at` and `media_position` update every second while playing): ```json { "sound_mode_list": "Произнеси текст, Выполни команду", "volume_level": 0.5, "is_volume_muted": false, "media_content_type": "music", "media_duration": 3721.6, "media_position": 110, "media_position_updated_at": "2020-07-03T09:24:21.688359+00:00", "media_title": "Cat Purr: 1 Hour Asmr Sound for Sleep, Study and Concentration", "media_artist": "Relaxing White Noise Sounds", "sound_mode": "Произнеси текст", "entity_picture_local": "/api/media_player_proxy/media_player.yandex_station_mini_living_room?token=xxxxxxx&cache=xxxxxxxxxxxxxxxx", "alice_state": "IDLE", "friendly_name": "Яндекс Станция Мини", "icon": "yandex:station-mini", "entity_picture": "https://avatars.yandex.net/get-music-content/163479/5f31b429.a.5492205-1/400x400", "supported_features": "83903", } ``` After pause: ```json { "sound_mode_list": "Произнеси текст, Выполни команду", "volume_level": 0.5, "is_volume_muted": false, "media_content_type": "music", "media_duration": 3721.6, "media_position": 181, "media_position_updated_at": "2020-07-03T09:25:29.796370+00:00", "media_title": "Cat Purr: 1 Hour Asmr Sound for Sleep, Study and Concentration", "media_artist": "Relaxing White Noise Sounds", "sound_mode": "Произнеси текст", "entity_picture_local": "/api/media_player_proxy/media_player.yandex_station_mini_living_room?token=xxxxxxx&cache=xxxxxxxxxxxxxxxx", "alice_state": "IDLE", "friendly_name": "Яндекс Станция Мини", "icon": "yandex:station-mini", "entity_picture": "https://avatars.yandex.net/get-music-content/163479/5f31b429.a.5492205-1/400x400", "supported_features": "83903", } ```
03397 commented 4 years ago

I have the exact same issue having a Sonos. I have already opened a ticket for this