+ | Failed: uint |
加载失败。 |
+ | Loading: uint |
正在加载。 |
+ | Ready: uint |
可播放。 |
+ | currentTime : float |
视频当前播放时间。
|
+ | duration : float |
视频总长度,只在加载状态是Ready的情况下有效。
|
+ | isPlaying : bool |
视频是否正在播放。
|
+ | state : uint |
获取视频加载状态。
|
|
+ | function hideText() |
停止播放视频。
|
+ | function pause() |
暂停视频。
|
+ | function play() |
播放视频。
|
+ | function showText(text : string, x : uint, y : uint, size : uint, color : uint) |
显示文本。 |
+ | function stop() |
停止播放视频。
|
local video = _Video.new('http://www.fancy3d.com/samp/sample.mp4')local state = _Video.Loading_app:onIdle(function() _rd:drawLine(0, _rd.h/2, _rd.w, _rd.h/2, _Color.Red) _rd:drawLine(_rd.w/2, 0, _rd.w/2, _rd.h, _Color.Red) state = video.stateend)local click = function(x,y) if x < _rd.w/2 and y < _rd.h/2 then if state == _Video.Loading then print('video is loading') elseif state == _Video.Ready then print('video duration is ', video.duration) video:play() elseif state == _Video.Failed then print('video is unknown') end end if x >= _rd.w/2 and y < _rd.h/2 and video.isPlaying then video:pause() print('current time is ', video.currentTime) end if y >= _rd.h/2 then video:stop() endendif _sys.os == 'ios' or _sys.os == 'android' then _app:onTouchBegin(click)else _app:onMouseDown(click)end