Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLaith Mohammad
6,569 Pointsthe answer should be setOnStart setOnFinished and a file instance?? yes they're incorrect, but I need help
Hello dudes,
I'm really losing my attention on the last few lectures of the java course, I feel they are very new to me and I'm lost during the video. I need some assistance in answering the quiz , thanks.
1 Answer
Benjamin Barslev Nielsen
18,958 PointsTo guide you, you can look at the API for MediaPlayer: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/media/MediaPlayer.html
We know that we can set events by calling a method setOn???. Now we only need to find out what replaces ???. Solving the quiz about the starting event: a quick search in the API for "setOn", shows the possible setOn??? methods and here we can see that there is one, that is named setOnPlaying. That seems correct.
Try to see if you can follow the same approach to find the method to send an event when the MediaPlayer should be stopped.
To solve what instance we need to pass into the MediaPlayer constructor we can again look at the API, and this time search for: "Constructor Summary". Now you can see which constructors MediaPlayer has, and from that you can read off which type of instance you should use to create a MediaPlayer.
Hope this helps solving the exercise and understanding an approach to solving such exercises.