Skip to content

Commit

Permalink
slidertest: stop auto updating if music paused
Browse files Browse the repository at this point in the history
  • Loading branch information
thyttan committed Sep 4, 2023
1 parent 51122a6 commit b27bdb2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/slidertest/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let initSlider2 = ()=>{
{useMap:true, steps:trackDur, currLevel:trackPosition, horizontal:true, rounded:false, timeout:0, useIncr:false, immediateDraw:false, propagateDrag:true, width:Math.round(R.w/20), xStart:R.x2-R.w/20-4, oversizeR:10, oversizeL:10, autoProgress:true, yStart: R.x+4, height: R.w-8}
);
sliderObject2.f.draw(sliderObject2.v.level);
sliderObject2.f.startAutoUpdate();
if (trackState==="play") sliderObject2.f.startAutoUpdate();
}

let init = ()=> {
Expand All @@ -49,10 +49,12 @@ Bangle.musicControl("volumegetlevel");
// Bangle.emit("message", type, msg);
let trackPosition = 0;
let trackDur = 30;
let trackState = "play";
let messageHandler = (type, msg)=>{
print(type, msg);
if (type='music'){

Check warning on line 55 in apps/slidertest/app.js

View workflow job for this annotation

GitHub Actions / build

Expected a conditional expression and instead saw an assignment
trackPosition = msg.position+1; // +1 to account for latency.
trackState = msg.state;
trackPosition = msg.position+trackState==="play"?1:0; // +1 to account for latency.
trackDur = msg.dur;
print('trackPosition: ' + trackPosition)
if (sliderObject2) {
Expand Down

0 comments on commit b27bdb2

Please sign in to comment.