1
00:00:01,650 --> 00:00:08,400
OK, in this video, we want to start to move our slider a second at a time as the song plays, so as

2
00:00:08,400 --> 00:00:12,210
the song is 10 seconds and the slider will have moved 10 spots.

3
00:00:12,240 --> 00:00:12,500
Right.

4
00:00:12,840 --> 00:00:19,170
And since our slider length in the last video is the length of the song, as it goes a second along,

5
00:00:19,350 --> 00:00:24,500
it will just like naturally look correct, you know, as the song progresses.

6
00:00:24,510 --> 00:00:26,340
So that's how we're going to do in this video.

7
00:00:26,370 --> 00:00:31,650
So let's come down here, same play time function underneath what we did.

8
00:00:31,650 --> 00:00:35,650
And I put a comma here set slider linked to the song length from our last video, forgot to comment

9
00:00:35,650 --> 00:00:35,820
it.

10
00:00:36,060 --> 00:00:39,270
So let's create a new comment right now and let's say.

11
00:00:40,250 --> 00:00:46,100
Move slider along one second at a time.

12
00:00:47,000 --> 00:00:51,140
All right, so let's create a variable and I'm going to call it next underscore time, and I'm going

13
00:00:51,140 --> 00:00:55,520
to set that equal to the integer of what our slider is so long.

14
00:00:55,520 --> 00:00:57,500
Underscore, slider, dot, get.

15
00:01:00,570 --> 00:01:07,560
Let's say the song starts, we're at zero, so song slider, get that get is zero, we're converting

16
00:01:07,570 --> 00:01:10,320
into an integer because it was zero point zero.

17
00:01:10,320 --> 00:01:11,520
So that'll just be zero.

18
00:01:11,520 --> 00:01:11,760
Right.

19
00:01:11,790 --> 00:01:18,900
So the next time the next thing forward is going to be whatever that is in this case, zero plus one.

20
00:01:19,470 --> 00:01:19,670
Right.

21
00:01:19,790 --> 00:01:25,700
So remember, this play time function gets run every one second.

22
00:01:25,710 --> 00:01:34,140
So every second this function, it's run again and this will add one to whatever the slider was before.

23
00:01:34,380 --> 00:01:36,500
So now we just need to output this.

24
00:01:36,510 --> 00:01:38,580
Analysts say output.

25
00:01:41,070 --> 00:01:50,010
New time value to slider so we can call our slider, let's go song underscore slider dat config and

26
00:01:50,010 --> 00:01:55,140
then we want to set the value that's currently where our little slider thing is.

27
00:01:55,530 --> 00:01:58,710
We just set that equal to next, underscore our time.

28
00:01:59,980 --> 00:02:02,230
So let's go ahead and save this and run it.

29
00:02:04,760 --> 00:02:08,990
And we can see we're at zero now we can as songs.

30
00:02:10,870 --> 00:02:11,640
Play this

31
00:02:14,480 --> 00:02:19,240
this down, turn the volume down a little bit and you can see it's moving along.

32
00:02:19,240 --> 00:02:22,290
So here says eight seconds in here, nine seconds.

33
00:02:22,300 --> 00:02:25,690
And this number and this number seem to be matched up.

34
00:02:26,170 --> 00:02:31,790
If we look back at our code, that label is the current song, slider position.

35
00:02:32,050 --> 00:02:33,310
Get the current value.

36
00:02:33,310 --> 00:02:33,650
Right.

37
00:02:34,030 --> 00:02:36,800
So, OK, that seems to be working.

38
00:02:39,070 --> 00:02:40,840
Now, if we try and drag this.

39
00:02:45,380 --> 00:02:52,730
You can see it's at one 15, one 16, and that's here is the elapsed time, thirty, thirty nine seconds,

40
00:02:52,730 --> 00:02:55,220
which is not particularly correct.

41
00:02:55,220 --> 00:02:57,470
And if we hit pause, it keeps moving.

42
00:02:57,480 --> 00:03:04,670
So we need to make some error handling and stuff built into this to make sure this works correctly.

43
00:03:05,360 --> 00:03:10,480
So we've got some stuff that we need to do here, but at least now it's sort of doing something.

44
00:03:10,500 --> 00:03:14,630
It seems to be moving as the song is moving.

45
00:03:14,640 --> 00:03:16,610
But you see now it's double counting.

46
00:03:16,610 --> 00:03:19,100
So there's all kinds of stuff we hit stop.

47
00:03:19,490 --> 00:03:20,600
It keeps going.

48
00:03:20,600 --> 00:03:21,770
So we need to work on this.

49
00:03:21,770 --> 00:03:24,230
We'll start we'll get into all of this in the next video.
