Skip to content

:time()

Reports current playback position in seconds.

With specified number argument jumps to a specified time forward (in seconds) for playback, similar to :seek(). Unlike seek(), calling :time() multiple times on a video is not additive.

Note: Currently L5 can only play ogv (Ogg Theora) video files. Use an external program such as Handbrake or ffmpeg (command line) to convert mp4, avi, mkv, and mov codecs first.

Examples

function setup()
  windowTitle("loadVideo example")

  video = loadVideo("assets/heads.ogv")
  video:play()

  describe("A basic example of loading a video, then beginning playback. Pressing the mouse returns total time since start of playback.")
end

function draw()
  background(51) 

  image(video, 0, 0, width, height)
end 

function mousePressed()
  print("Time since start "..video:time())
end

Syntax

videofile:time(time)
videofile:time()

Parameters

Parameter
time Number: number of seconds from start of video to move the playhead.

Returns

Number: Total seconds since start of playback.