## MPEG1(filename, audioopt)

Constructor

#### # new MPEG1(filename, audioopt)

load MPEG1 for video/audio playback. Videos can be converted using ffmpeg, e.g. for converting to MPEG1 with 320 width: "ffmpeg -i infile -filter:v scale=320:-1 -c:v mpeg1video -c:a mp2 -format mpeg outfile"

Note: MPEG1 module must be loaded by calling LoadLibrary("mpeg1") before using!

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`filename` | string |  | file name of the soundfile to load.
`audio` | bool | <optional> | enable audioo playback with true, disable with false (default: false).

See:
  - LoadLibrary()

# Members

Type: number

#### # duration

video duration in seconds

Type: string

#### # filename

name of file

Type: number

#### # framerate

frame rate.

Type: number

#### # height

video height

Type: number

#### # samplerate

audio sample rate.

Type: number

#### # width

video width

# Methods

#### # Close()

Close MPEG1.

#### # CurrentTime() → {number}

current play pos

Returns:

the current video position in seconds

Type: number

#### # HasEnded()

check if playback has ended.

Returns:

true if the video has ended, else false.

#### # Play(x, y)

must be called periodically (e.g. every Loop()) to render audio/video.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | x position of the upper left corner of the video
`y` | number | y position of the upper left corner of the video

#### # Rewind()

rewind to the start of the video.

#### # Seek(tidx)

seek to given time index.

##### Parameters:

Name | Type | Description
--- | --- | ---
`tidx` | number | the index in seconds