HTML and CSS Reference
In-Depth Information
Listing 8.7. index.html—Adding the <source> element
Code check!
This is a good time to stop and check your progress in the browser. You can find the code
to this point in the build in the code download, in a file named index-3.html. Compare your
index.html code with that code if you have any problems.
8.3.1. Discovering which video is playing with .currentSrc
With the new code, Firefox will now load the video it's able to play. This does introduce
a problem for your jukebox feature. Before, you were able to set the .src property
to change the video, but now you need to set the .src differently depending on what
video file the browser selected to play. Unfortunately, you can't replace all of the child
<source> elements with a new set; to change the playing video you have to set the .src
property.
To solve this problem you need to know about another property of the HTMLMedia-Ele-
ment interface: .currentSrc . This property tells you the filename of the currently se-
lected media.
 
Search WWH ::




Custom Search