Class VideoPlayer
VideoPlayer is a video playback class. EasyAR supports normal video, transparent video, and streaming playback. Video content will be rendered to the texture passed into setRenderTexture. This class supports only OpenGLES 3.0 textures. Because it depends on OpenGLES, all functions of this class (including the destructor) must be called in a single thread that contains an OpenGLES context. The current version requires both width and height to be multiples of 16. Supported video file formats Windows: Media Foundation-compatible formats. Installing additional decoders can support more formats. See Supported Media Formats in Media Foundation . DirectShow is not supported. Mac: Not supported. Android: System-supported formats. See Supported media formats . iOS: System-supported formats. There is currently no valid reference document.
VideoPlayer
Constructors
VideoPlayer
void easyar_VideoPlayer__ctor(easyar_VideoPlayer * * Return)
+ (easyar_VideoPlayer *) create
public convenience init()
Methods
isAvailable
Checks whether it is available. Returns true only on Windows, Android, and iOS, and is unavailable on Mac.
bool easyar_VideoPlayer_isAvailable(void)
static bool isAvailable()
public static boolean isAvailable()
companion object fun isAvailable(): Boolean
public static func isAvailable() -> Bool
public static bool isAvailable()
Returns
setVideoType
Sets the video type. If not set manually, it defaults to the normal type. This method must be called before open.
void easyar_VideoPlayer_setVideoType(easyar_VideoPlayer * This, easyar_VideoType videoType)
void setVideoType(VideoType videoType)
public void setVideoType(int videoType)
fun setVideoType(videoType: Int): Unit
- (void)setVideoType:(easyar_VideoType)videoType
public func setVideoType(_ videoType: VideoType) -> Void
public virtual void setVideoType(VideoType videoType)
Parameters
Returns
setRenderTexture
Passes the texture used to display video into the player. This method must be called before open.
void easyar_VideoPlayer_setRenderTexture(easyar_VideoPlayer * This, easyar_TextureId * texture)
void setRenderTexture(std::shared_ptr<TextureId> texture)
public void setRenderTexture(@Nonnull TextureId texture)
fun setRenderTexture(texture: TextureId): Unit
- (void)setRenderTexture:(easyar_TextureId *)texture
public func setRenderTexture(_ texture: TextureId) -> Void
public virtual void setRenderTexture(TextureId texture)
Parameters
Returns
open
Opens a video from path. path can be a local video file (path/to/video.mp4) or a url (http://www.../.../video.mp4). storageType indicates the type of path. See StorageType for details. This method is asynchronous. open may take some time to complete. If you want to know the result of opening the video or the playback status, you need to handle callback data. callback will be called in the thread corresponding to callbackScheduler. You can check in the callback whether opening completed successfully and start playback after it opens successfully.
void easyar_VideoPlayer_open(easyar_VideoPlayer * This, easyar_String * path, easyar_StorageType storageType, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromVideoStatus callback)
void open(std::string path, StorageType storageType, std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(VideoStatus)>> callback)
public void open(java.lang.@Nonnull String path, int storageType, @Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromVideoStatus callback)
fun open(path: String, storageType: Int, callbackScheduler: CallbackScheduler, callback: FunctorOfVoidFromVideoStatus?): Unit
- (void)open:(NSString *)path storageType:(easyar_StorageType)storageType callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler callback:(void (^)(easyar_VideoStatus status))callback
public func `open`(_ path: String, _ storageType: StorageType, _ callbackScheduler: CallbackScheduler, _ callback: ((VideoStatus) -> Void)?) -> Void
public virtual void open(string path, StorageType storageType, CallbackScheduler callbackScheduler, Optional<Action<VideoStatus>> callback)
Parameters
Returns
close
void easyar_VideoPlayer_close(easyar_VideoPlayer * This)
public func close() -> Void
public virtual void close()
Returns
play
Starts or resumes video playback.
bool easyar_VideoPlayer_play(easyar_VideoPlayer * This)
public func play() -> Bool
public virtual bool play()
Returns
stop
void easyar_VideoPlayer_stop(easyar_VideoPlayer * This)
public func stop() -> Void
public virtual void stop()
Returns
pause
void easyar_VideoPlayer_pause(easyar_VideoPlayer * This)
public func pause() -> Void
public virtual void pause()
Returns
isRenderTextureAvailable
Whether the video texture can be used for rendering. It can be used to check whether the texture passed into player has been touched.
bool easyar_VideoPlayer_isRenderTextureAvailable(easyar_VideoPlayer * This)
bool isRenderTextureAvailable()
public boolean isRenderTextureAvailable()
fun isRenderTextureAvailable(): Boolean
- (bool)isRenderTextureAvailable
public func isRenderTextureAvailable() -> Bool
public virtual bool isRenderTextureAvailable()
Returns
updateFrame
Updates texture data. This method must be called on the rendering thread when isRenderTextureAvailable returns true.
void easyar_VideoPlayer_updateFrame(easyar_VideoPlayer * This)
public void updateFrame()
public func updateFrame() -> Void
public virtual void updateFrame()
Returns
duration
Returns the video length. Use after a successful open.
int easyar_VideoPlayer_duration(easyar_VideoPlayer * This)
public func duration() -> Int32
public virtual int duration()
Returns
currentPosition
Returns the current playback position of the video. Use after a successful open.
int easyar_VideoPlayer_currentPosition(easyar_VideoPlayer * This)
public int currentPosition()
fun currentPosition(): Int
public func currentPosition() -> Int32
public virtual int currentPosition()
Returns
seek
Adjusts the playback position to position. Use after a successful open.
bool easyar_VideoPlayer_seek(easyar_VideoPlayer * This, int position)
public boolean seek(int position)
fun seek(position: Int): Boolean
- (bool)seek:(int)position
public func seek(_ position: Int32) -> Bool
public virtual bool seek(int position)
Parameters
| Name |
Type |
Description |
| position |
Int32 |
|
Returns
size
Returns the video width and height. Use after a successful open.
easyar_Vec2I easyar_VideoPlayer_size(easyar_VideoPlayer * This)
public @Nonnull Vec2I size()
public func size() -> Vec2I
public virtual Vec2I size()
Returns
volume
Returns the video volume. Use after a successful open.
float easyar_VideoPlayer_volume(easyar_VideoPlayer * This)
public func volume() -> Float
public virtual float volume()
Returns
setVolume
Sets the video volume. Use after a successful open.
bool easyar_VideoPlayer_setVolume(easyar_VideoPlayer * This, float volume)
bool setVolume(float volume)
public boolean setVolume(float volume)
fun setVolume(volume: Float): Boolean
- (bool)setVolume:(float)volume
public func setVolume(_ volume: Float) -> Bool
public virtual bool setVolume(float volume)
Parameters
| Name |
Type |
Description |
| volume |
Single |
|
Returns