Copyright © 2001-2019 MultiMedia Soft

How to manage delayed playbacks

Previous pageReturn to chapter overviewNext page

Active DJ Studio allows setting up a list of sound files whose playback can be programmed to start after a given delay through a set of methods of the DelayedPlayback COM object.

 

Each sound file (item) can be added to the list of delayed playbacks in 2 different ways:

 

by setting a specific amount of delay through the DelayedPlayback.ListAddItem or DelayedPlayback.ListAddItemEx methods
by setting a specific date and time through the DelayedPlayback.ListAddItemByDate or DelayedPlayback.ListAddItemByDateEx methods

 

in both cases mentioned methods will return back a unique identifier that will be then used in order to access the item itself at a later stage.

 

Each item can be removed from the list through the DelayedPlayback.ListRemoveItem method and the whole list can be emptied through the DelayedPlayback.ListRemoveAll method.

The number of items inside the list can be enumerated through the DelayedPlayback.ListGetCount method.

 

If time positioning and duration of a certain item should overlap with the time positioning and duration of an existing item, you could decide if accepting or denying its insertion inside the list through the DelayedPlayback.AllowOverlapping property: if overlapping shouldn't be allowed, an ERR_DELAYED_PLAYBACK_OVERLAP error would be generated in case of overlapping. Note that, in case of overlapping, the playing song would be immediately stopped without any kind of fade-out when an overlapped song should be started.

 

As already mentioned, each item is identified through its unique identifier: this identifier is passed as a parameter for accessing the following item's related features:

 

Get its duration through the DelayedPlayback.ItemGetDuration method
Start an immediate playback of the item through the DelayedPlayback.ItemPlayNow method with the option to keep it or remove it from the list
Set the effective range that will be played through the DelayedPlayback.ItemSetRange method: this range can be obtained through the DelayedPlayback.ItemGetRange method
Change or update the item's playback delay through the DelayedPlayback.ItemResetDelay method
Set the number of loops that will be performed on the given item through the DelayedPlayback.ItemSetLoopCount method: the number of loops can be obtained through the DelayedPlayback.ItemGetLoopCount method
Set the fade-in and fade-out time applied to start and end of playback through the DelayedPlayback.ItemSetFadeTime method: current fade-in and fade-out time can be obtained through the DelayedPlayback.ItemGetFadeTime method

 

 

Delayed playbacks are mainly intended for usage with regular audio files so encrypted audio files and video clips are not supported directly. A possible trick for using encrypted audio files and video clips with delayed playback would be the following:

 

Load the file into the player using LoadEncryptedSound or VideoPlayer.Load methods
Call DelayedPlayback.ListAddItem passing the index of the involved player and an empty pathname: this will force the player to start playback of its actual contents.

 

As you may understand, with this trick there would be no possibility to add more than one single file to the list of delayed playbacks for the involved player.