1
00:00:01,740 --> 00:00:06,410
OK, so we've got our slider now, we need to talk about the sort of the length of the slider, the

2
00:00:06,720 --> 00:00:07,850
to and from.

3
00:00:07,860 --> 00:00:09,300
So if we come down to our slider.

4
00:00:12,350 --> 00:00:16,310
You see, we set it up, we want to go from zero.

5
00:00:17,410 --> 00:00:21,850
Too, and we set it up in the last year to one hundred now, every time a new song plays, we want that

6
00:00:21,850 --> 00:00:24,100
to to be the length of the song.

7
00:00:24,280 --> 00:00:28,270
So that's what we're going to do in this video, because as the slider moves along and when it gets

8
00:00:28,270 --> 00:00:30,670
to the end of the slider, that needs to be the end of the song.

9
00:00:30,670 --> 00:00:30,870
Right.

10
00:00:30,940 --> 00:00:34,820
So this needs to change every time so we can do that fairly easily.

11
00:00:35,170 --> 00:00:41,580
So let's head up here to our, let's see, playtime function.

12
00:00:41,590 --> 00:00:45,700
So think about a song when we click play, let's go to our play function.

13
00:00:46,210 --> 00:00:50,080
It grabs the song, does it stuff as it to the mixer and starts playing it.

14
00:00:50,080 --> 00:00:55,120
And then it runs this play time function, which is up here inside this play time function.

15
00:00:55,120 --> 00:00:57,400
We're doing all kinds of stuff with song length.

16
00:00:57,400 --> 00:00:57,760
Right.

17
00:00:57,760 --> 00:01:02,080
We're getting the the current or the total length of the song.

18
00:01:02,080 --> 00:01:03,850
We're getting the current time of the song.

19
00:01:03,850 --> 00:01:04,990
We're doing all kinds of time stuff.

20
00:01:04,990 --> 00:01:08,980
So it makes sense that probably in here we should do what we want to do.

21
00:01:08,980 --> 00:01:11,560
So this is the status bar thing.

22
00:01:11,560 --> 00:01:14,050
Let's give ourselves some space here and now.

23
00:01:14,050 --> 00:01:17,500
Let's let's go song, slider, config.

24
00:01:18,470 --> 00:01:22,630
And we want to set the to value equal to what?

25
00:01:22,910 --> 00:01:27,920
Well, if we come up here, we can find this song length, we've got song length and we've got converted

26
00:01:27,920 --> 00:01:28,580
song length.

27
00:01:28,580 --> 00:01:33,470
So the converted song link is, remember, we change it to that time sort of output.

28
00:01:33,470 --> 00:01:33,680
Right.

29
00:01:33,690 --> 00:01:35,930
So minutes, seconds.

30
00:01:35,930 --> 00:01:38,510
So zero zero Colan zero zero.

31
00:01:38,700 --> 00:01:44,900
So a song that's two minutes and 20 seconds would be zero to Colen twenty two or whatever.

32
00:01:45,090 --> 00:01:46,370
We don't really want that.

33
00:01:46,380 --> 00:01:52,670
What we want is just like the raw seconds, so you know, one hundred and forty seconds or whatever.

34
00:01:52,670 --> 00:01:55,400
So that is just this song length.

35
00:01:55,610 --> 00:01:57,080
So we could set that equal to that.

36
00:01:57,080 --> 00:01:58,910
So every time this thing runs.

37
00:02:00,320 --> 00:02:00,690
Right.

38
00:02:01,580 --> 00:02:04,610
This will get changed to whatever the current song length is.

39
00:02:04,640 --> 00:02:08,140
So if we play a different song, the play function will fire.

40
00:02:08,480 --> 00:02:12,230
It will then play this play time function and this will be updated automatically.

41
00:02:12,230 --> 00:02:15,670
So let's output this to the screen just to see what's going on here.

42
00:02:15,680 --> 00:02:20,390
So come down to the very bottom and let's grab our temporary label guy.

43
00:02:20,450 --> 00:02:23,210
Right, and come back up here and underneath here.

44
00:02:23,210 --> 00:02:28,610
Let's just soska my label that config and let's set the text equal to that song.

45
00:02:28,610 --> 00:02:30,920
Underscore Slider doGet.

46
00:02:30,920 --> 00:02:32,780
We can always get whatever it currently is.

47
00:02:32,940 --> 00:02:34,250
So, OK, let's save this.

48
00:02:34,250 --> 00:02:38,720
Now, this is going to make our app a little bit bigger.

49
00:02:38,720 --> 00:02:39,710
So let's come up here.

50
00:02:39,950 --> 00:02:43,190
Let's add another 50 pixels just so we can see that label easier.

51
00:02:43,430 --> 00:02:44,960
OK, so let's go and save this.

52
00:02:45,830 --> 00:02:46,050
All right.

53
00:02:46,070 --> 00:02:47,480
So let's run this.

54
00:02:49,030 --> 00:02:50,620
As some songs zuppa.

55
00:02:52,230 --> 00:02:58,140
So let's play one, it's zero now, but as we slide this to the end, it should be what, the song.

56
00:02:59,160 --> 00:03:07,560
It turns down what the this so two 30, that's a minute, that's 60 seconds, times two, which is one

57
00:03:07,560 --> 00:03:10,080
hundred twenty plus thirty seconds, which is one hundred fifty.

58
00:03:10,290 --> 00:03:12,410
And sure enough we see one hundred and fifty here.

59
00:03:12,630 --> 00:03:15,360
Now we're getting a bunch of decimals here.

60
00:03:15,360 --> 00:03:19,860
So maybe, maybe we want to convert this to an integer.

61
00:03:20,420 --> 00:03:24,540
We'll talk about that later, but we can change this to a different song.

62
00:03:24,840 --> 00:03:27,630
And when we do and then we slide this thing again.

63
00:03:27,840 --> 00:03:29,270
We see now it's at one hundred.

64
00:03:29,670 --> 00:03:32,540
Well, this one has 60 seconds plus 40 seconds.

65
00:03:32,760 --> 00:03:33,980
That's one hundred seconds.

66
00:03:34,200 --> 00:03:36,680
So this is now the length of one hundred.

67
00:03:36,690 --> 00:03:38,070
And again, we've got these decimals.

68
00:03:38,370 --> 00:03:40,110
We might change this to an integer.

69
00:03:40,110 --> 00:03:42,540
So let's just say one hundred instead of one hundred point eighty.

70
00:03:42,780 --> 00:03:42,940
Right.

71
00:03:43,050 --> 00:03:45,210
So OK, so far so good.

72
00:03:45,420 --> 00:03:52,230
Now that we have our slider that size now we can work on moving the slider a bit at a time as the song

73
00:03:52,230 --> 00:03:53,310
moves forward.

74
00:03:53,460 --> 00:03:55,350
And I think we'll look at that in the next video.
