PennController.AddHost( url )

You can use AddHost to spare you from specifying a URL when you create an element with newAudio, newVideo or newImage. The URL must end with /.

You can pass multiple URL strings (separated by comma) or use AddHost as many times as you want. If you do so, PennController will try to look for audio/images at the host URLs in the order they were provided, and stop looking as soon as it finds one.

Note that you can still directly specify URLs when creating a new element even if you added a host URL with AddHost.


[js highlight=”1,2″ try=”data”]

newImage(“ibex”, “ibex.jpg”)
newImage(“wait”, “”)
newAudio(“sentence”, “test.mp3”)

The trial shows two images and plays one audio file. PennController will first try send a request for the file and another one for the file The same is true for the audio file: PennController will first send a request for the file and another one for the file PennController uses the resource from the first successfully resolving request: in this example, assuming there is a file named ibex.png at and a file named test.mp3 at (and only there), those are the resources that PennController will use (it may still trigger warnings in the console for the unsuccessful requests). PennController will only look for the wait image at, since a full URL is provided there.