1
00:00:01,600 --> 00:00:06,790
OK, so everything's working fine, except for when we move our slider around, the elapsed time gets

2
00:00:06,790 --> 00:00:07,420
all messed up.

3
00:00:07,420 --> 00:00:09,250
So we're going to fix that in this video.

4
00:00:09,280 --> 00:00:12,420
Let's head up to our play time function.

5
00:00:13,180 --> 00:00:22,090
And so if the song is pause, we stop else where we are increasing the slider one second at a time right

6
00:00:22,090 --> 00:00:22,540
here.

7
00:00:23,080 --> 00:00:29,290
And then our song, Slider, we're configuring it to whatever the song length is of the song.

8
00:00:29,710 --> 00:00:33,940
And the value is that next time that that variable plus one.

9
00:00:34,180 --> 00:00:41,020
Well, right underneath here inside this function, we can play around with our status bar as well,

10
00:00:41,020 --> 00:00:46,380
since this is sort of what makes our current time equal.

11
00:00:46,380 --> 00:00:47,980
The slider get position.

12
00:00:48,310 --> 00:00:52,660
This is the logical place to put the status bar updating as well.

13
00:00:52,690 --> 00:00:59,890
So first off, remember how we did the status bar before we set the elapsed time to convert at current

14
00:00:59,890 --> 00:01:00,370
time.

15
00:01:00,610 --> 00:01:02,110
So let's come up here and grab that.

16
00:01:02,110 --> 00:01:06,210
That's just defined up here as converted current time.

17
00:01:06,700 --> 00:01:12,580
So let's grab this and you'll notice we're converting the current time to that time format.

18
00:01:12,580 --> 00:01:15,190
Well, we want to do the same thing, except.

19
00:01:15,610 --> 00:01:16,680
Well, let me just show you.

20
00:01:17,020 --> 00:01:18,130
So let's pace this in.

21
00:01:19,180 --> 00:01:20,340
Let's go to.

22
00:01:22,700 --> 00:01:29,270
Convert slider position to time format.

23
00:01:29,830 --> 00:01:37,100
So our song slider, the value of it, the get value of it is currently what our time value is for our

24
00:01:37,100 --> 00:01:41,320
song, because we've dragged it forward to, let's say, a minute into the song.

25
00:01:41,660 --> 00:01:49,130
So our song, Slider doGet will be 60, 60 seconds, while the integer value of it will be sixty point

26
00:01:49,130 --> 00:01:49,520
whatever.

27
00:01:49,520 --> 00:01:51,070
But we just want the integer value.

28
00:01:51,080 --> 00:01:57,980
So here when we're converting that 60 seconds or whatever that song Slider doGet is, in fact we just

29
00:01:57,980 --> 00:01:58,610
copy this.

30
00:01:58,940 --> 00:02:04,340
We can convert that to time format by instead of passing the current time we pass that current song

31
00:02:04,340 --> 00:02:05,090
Sleater get.

32
00:02:05,490 --> 00:02:11,960
Now we also, like I said, we want to change this to an integer just to make it even add another bracket

33
00:02:11,960 --> 00:02:14,310
to the end and make sure you've got the right number of these.

34
00:02:14,310 --> 00:02:17,720
It looks like we've got one, two, three, four of these guys now.

35
00:02:18,080 --> 00:02:20,160
So that should work.

36
00:02:20,990 --> 00:02:29,090
Now let's output slider and I'm just going to come down here to our status bar and copy this whole thing.

37
00:02:30,030 --> 00:02:31,290
And paste it in.

38
00:02:32,240 --> 00:02:34,470
And again, we're inside this function still.

39
00:02:34,730 --> 00:02:41,000
So what we're doing here is we're setting the time elapsed to the converted current time, but what's

40
00:02:41,000 --> 00:02:42,280
the converted current time?

41
00:02:42,770 --> 00:02:49,840
That's this thing right here, which is our current slider position converted into time format.

42
00:02:49,850 --> 00:02:50,100
Right.

43
00:02:50,540 --> 00:02:51,440
So, OK.

44
00:02:52,390 --> 00:02:57,160
That looks good and the reason why we're doing this inside of here and leaving this outside of here,

45
00:02:57,160 --> 00:03:02,770
because if the song is just playing and we haven't moved the slider around, the old way of doing it

46
00:03:03,040 --> 00:03:04,740
this way still works.

47
00:03:04,750 --> 00:03:06,100
So we'll just leave that alone.

48
00:03:06,340 --> 00:03:09,640
OK, so let's go ahead and save this and run it.

49
00:03:09,670 --> 00:03:10,720
Make sure that worked.

50
00:03:13,720 --> 00:03:15,210
So let's add some songs.

51
00:03:17,690 --> 00:03:22,900
And let's play one volume down, so we've got three seconds, four seconds.

52
00:03:23,020 --> 00:03:29,290
Now, if we move this forward, it says one 50 if we move it backwards.

53
00:03:29,660 --> 00:03:30,750
Thirty two seconds.

54
00:03:30,760 --> 00:03:32,120
Twenty one seconds, whatever.

55
00:03:32,410 --> 00:03:37,680
So as this moves forward, it updates and we're good to go.

56
00:03:37,690 --> 00:03:40,770
So, OK, we are almost done here.

57
00:03:40,780 --> 00:03:45,280
There's still a few little things we need to worry about, one of which is what happens at the end here.

58
00:03:45,290 --> 00:03:45,610
So.

59
00:03:47,610 --> 00:03:55,460
Twenty five, twenty six seven, twenty eight point nine, thirty thirty one, thirty two, thirty three,

60
00:03:55,470 --> 00:03:56,490
it just keeps going.

61
00:03:56,490 --> 00:04:00,050
We're at the end of our thing here but this guy keeps on going.

62
00:04:00,060 --> 00:04:01,440
It doesn't know that the song's over.

63
00:04:01,440 --> 00:04:02,550
It just keeps ticking away.

64
00:04:02,550 --> 00:04:05,490
So we need to do some work on that.

65
00:04:05,490 --> 00:04:07,140
And I think we'll do that in the next video.
