Class VideoPlayer
VideoPlayer adalah kelas playback video. EasyAR mendukung video normal, video transparan, dan streaming playback. Konten video akan dirender ke texture yang diteruskan ke setRenderTexture. Kelas ini hanya mendukung texture OpenGLES 3.0. Karena bergantung pada OpenGLES, semua fungsi kelas ini (termasuk destructor) harus dipanggil dalam satu thread yang memiliki konteks OpenGLES. Versi saat ini mengharuskan lebar dan tinggi merupakan kelipatan 16. Format file video yang didukung Windows: Format yang kompatibel dengan Media Foundation. Menginstal decoder tambahan dapat mendukung lebih banyak format. Lihat Supported Media Formats in Media Foundation . DirectShow tidak didukung. Mac: Tidak didukung. Android: Format yang didukung sistem. Lihat Supported media formats . iOS: Format yang didukung sistem. Saat ini tidak ada dokumen referensi yang valid.
VideoPlayer
Konstruktor
VideoPlayer
void easyar_VideoPlayer__ctor(easyar_VideoPlayer * * Return)
+ (easyar_VideoPlayer *) create
public convenience init()
Metode
isAvailable
Memeriksa apakah tersedia. Hanya mengembalikan true di Windows, Android, dan iOS, serta tidak tersedia di 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()
Mengembalikan
setVideoType
Mengatur tipe video. Jika tidak diatur secara manual, default-nya adalah tipe normal. Metode ini harus dipanggil sebelum 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)
Parameter
Mengembalikan
setRenderTexture
Meneruskan texture yang digunakan untuk menampilkan video ke player. Metode ini harus dipanggil sebelum 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)
Parameter
Mengembalikan
open
Membuka video dari path. path dapat berupa file video lokal (path/to/video.mp4) atau url (http://www.../.../video.mp4). storageType menunjukkan tipe path. Lihat StorageType untuk detail. Metode ini asynchronous. open mungkin memerlukan waktu untuk selesai. Jika Anda ingin mengetahui hasil pembukaan video atau status playback, Anda perlu menangani data callback. callback akan dipanggil di thread yang sesuai dengan callbackScheduler. Anda dapat memeriksa dalam callback apakah pembukaan selesai dengan sukses dan mulai playback setelah berhasil dibuka.
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)
Parameter
Mengembalikan
close
void easyar_VideoPlayer_close(easyar_VideoPlayer * This)
public func close() -> Void
public virtual void close()
Mengembalikan
play
Memulai atau melanjutkan playback video.
bool easyar_VideoPlayer_play(easyar_VideoPlayer * This)
public func play() -> Bool
public virtual bool play()
Mengembalikan
stop
Menghentikan playback video.
void easyar_VideoPlayer_stop(easyar_VideoPlayer * This)
public func stop() -> Void
public virtual void stop()
Mengembalikan
pause
void easyar_VideoPlayer_pause(easyar_VideoPlayer * This)
public func pause() -> Void
public virtual void pause()
Mengembalikan
isRenderTextureAvailable
Apakah texture video dapat digunakan untuk rendering. Ini dapat digunakan untuk memeriksa apakah texture yang diteruskan ke player sudah disentuh.
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()
Mengembalikan
updateFrame
Memperbarui data texture. Metode ini harus dipanggil pada rendering thread ketika isRenderTextureAvailable mengembalikan true.
void easyar_VideoPlayer_updateFrame(easyar_VideoPlayer * This)
public void updateFrame()
public func updateFrame() -> Void
public virtual void updateFrame()
Mengembalikan
duration
Mengembalikan panjang video. Gunakan setelah open berhasil.
int easyar_VideoPlayer_duration(easyar_VideoPlayer * This)
public func duration() -> Int32
public virtual int duration()
Mengembalikan
currentPosition
Mengembalikan posisi playback video saat ini. Gunakan setelah open berhasil.
int easyar_VideoPlayer_currentPosition(easyar_VideoPlayer * This)
public int currentPosition()
fun currentPosition(): Int
public func currentPosition() -> Int32
public virtual int currentPosition()
Mengembalikan
seek
Menyesuaikan posisi playback ke position. Gunakan setelah open berhasil.
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)
Parameter
| Nama |
Tipe |
Deskripsi |
| position |
Int32 |
|
Mengembalikan
size
Mengembalikan lebar dan tinggi video. Gunakan setelah open berhasil.
easyar_Vec2I easyar_VideoPlayer_size(easyar_VideoPlayer * This)
public @Nonnull Vec2I size()
public func size() -> Vec2I
public virtual Vec2I size()
Mengembalikan
volume
Mengembalikan volume video. Gunakan setelah open berhasil.
float easyar_VideoPlayer_volume(easyar_VideoPlayer * This)
public func volume() -> Float
public virtual float volume()
Mengembalikan
setVolume
Mengatur volume video. Gunakan setelah open berhasil.
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)
Parameter
| Nama |
Tipe |
Deskripsi |
| volume |
Single |
|
Mengembalikan