https://github.com/defold/extension-videoplayer-mpeg
Native extension to play back mpeg1 video using pl_mpeg
https://github.com/defold/extension-videoplayer-mpeg
Last synced: 9 months ago
JSON representation
Native extension to play back mpeg1 video using pl_mpeg
- Host: GitHub
- URL: https://github.com/defold/extension-videoplayer-mpeg
- Owner: defold
- License: mit
- Created: 2024-07-01T05:35:50.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-12T20:45:50.000Z (almost 2 years ago)
- Last Synced: 2025-01-28T16:41:03.511Z (over 1 year ago)
- Language: C
- Homepage:
- Size: 13.2 MB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# extension-videoplayer-mpeg
Native extension to play back MPEG1 video using [pl_mpeg](https://github.com/phoboslab/pl_mpeg).
## Usage
```lua
local buffer = resource.load(filename)
-- open video
local handle, err = mpeg.open(buffer, { loop = true })
if err then
error(err)
return
end
-- get video information
local info = mpeg.get_info(handle)
print(info.width, info.height) -- video width and height
print(info.time, info.duration) -- current playback time and video duration
-- get the buffer where video frames will be decoded
local framebuffer = mpeg.get_frame(handle)
-- advance playback and decode a new frame
mpeg.decode(handle, seconds)
-- seek to exactly 10 seconds and decode a new frame
local exact = true
mpeg.seek(handle, 10, exact)
-- close video and release all resources
mpeg.close(handle)
```