Setting volume on 2nd client causes too many xhr requests
Closed this issue · 2 comments
Reproduce:
- Open on device
- Open in browser
- Change volume in browser
- Observe xhr calls on device
Actual:
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"743","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
callCommand : setvol 13
HTTP Request: http://192.168.0.102/command/?cmd=setvol 13
callCommand : setvol 13
HTTP Request: http://192.168.0.102/command/?cmd=setvol 13
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"743","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"743","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"743","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
callCommand completed
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
callCommand completed
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"744","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"744","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"744","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"744","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
HTTP Response :
{"volume":"13","repeat":"0","random":"0","single":"0","consume":"1","playlist":"2","playlistlength":"65","xfade":"0","mixrampdb":"0.000000","mixrampdelay":"nan","state":"play","song":"44","songid":"44","time":"0","elapsed":"744","bitrate":"45","audio":"44100:16:2","nextsong":"45","nextsongid":"45","OK":null,"song_percent":0,"audio_sample_rate":"44.1","audio_sample_depth":"16","audio_channels":"Stereo","currentartist":null,"currentsong":"CBC_R1_TOR_H_SC","currentalbum":null,"fileext":"c...
Status updated...
HTTP Request: http://192.168.0.102/_player_engine.php?state=play
Expected:
- State updated event
- ui update
- listenForUpdate
There should be no set volume command called.
Source of problem is that the status updated handler tries to set the JS binding to "" temporarily, then re-adds after the UI has been updated. It is done to avoid the volume updated event from triggering an update. It seems that when you object.connect(function...) it is not replacing the existing binding, but actually adding an additional binding.
According to this: https://developer.blackberry.com/native/reference/cascades/qmlevents.html
should use object.disconnect() vs trying to re-assign existing connection...oops.