media.eh

Basic media support. More...

use "media.eh"

Types

type Player < Any;

Functions

def get_supported_ctypes(): [String];
def new_player(in: IStream, ctype: String): Player;
def play_tone(note: Int, duration: Int, volume: Int);
def Player.close();
def Player.get_ctype(): String;
def Player.get_duration(): Long;
def Player.get_time(): Long;
def Player.set_loops(count: Int);
def Player.set_time(time: Long);
def Player.start();
def Player.stop();

Description

Type details

type Player < Any;
A player of media data.

Function details

def get_supported_ctypes(): [String];
Returns list of all supported content types.

def play_tone(note: Int, duration: Int, volume: Int);
Plays a specified tone. A note is in the range 0..127. A volume is in the range 0..100. A duration is given in milliseconds and must be positive.

This function is non-blocking, it returns immediately and note is played back in the background.

def new_player(in: IStream, ctype: String): Player;
Creates new player with given data source and content type.

def Player.get_ctype(): String;
Returns the content type of the media that is being played back by this player.

def Player.set_loops(count: Int);
Sets the number of times the player will loop and play the content. By default, the media is played once. If loop count is set to -1, content will be played indefinitely.

def Player.get_duration(): Long;
Returns the duration of the media in milliseconds.

def Player.get_time(): Long;
Returns current position of the media in milliseconds. If current position is unknown, the function returns -1.

def Player.set_time(time: Long);
Sets current position in the media to play from. For some content types may be not very accurate. There are media types that cannot support the setting of media time, for these types, ERR_MEDIA error is raised.

def Player.start();
Starts playback of this player. If player was stopped previously, playback is resumed from where it was previously stopped. If the player has reached the end of media, calling start() will automatically start the playback from the beginning of the media.

def Player.stop();
Pauses playback at the current media time.

def Player.close();
Closes this player and releases its resources. Calling this method will also close associated input stream.