|
Description
Similar to PKL_LoadAndPlay(), however, the track doesn't start to play. This feature is helpful for local files and allows for operations to be conducted on the media asset (such as setting the playhead position) prior to initiating playback. Another use for this feature is to allow for the file to load in the background, providing an overall better playback experience once the user clicks the "play" button.
Once preloading has started, you will be able to determine how much of the file is loaded using PKL_GetInfo() function.
Usage
PKL_LoadAndPlay(DataObject:Object) :Void
Parameters
DataObject:Object - An Object, or JSON containing the following values:
- player
- file
- title
- artist
- image
Returns
Boolean (true of false)
Example Code
If only one player exists on the page:
<script language="javascript">
PKL_PreloadMedia( { file: "track1.mp3"} );
</script>
Multiple players require including "player" to specify which player
<script language="javascript">
PKL_PreloadMedia( { player: "MyPlayer1", file: "track1.mp3"} );
</script>
Using an Object instead of JSON
<script language="javascript">
var MyData = new Object():
MyData.player = "MyPlayer1";
MyData.file = "track1.mp3";
PKL_PreloadMedia(MyData);
</script>
|