I'm supposed to write an app for iOS and Android that sometimes shows a customized video player on a part of the screen. I have to be able to control it (seek, play, pause, set speed, choose video...). I know that such media is not yet supported in Gluon.
But would it be possible to write such a thing in XCode and Android Studio and somehow embed it in a Gluon app?
The native video player (or in this case the method of "previewing" a video) was used in the following example:
https://gist.github.com/bgmf/d87a2bac0a5623f359637a3da334f980
Beside some prerequisites, the code looks like this:
Following the design patterns in the Gluon Charm Down library, this could be a basic Android implementation of a
VideoService
.It is based on this tutorial, and adapted to be used on the current
SurfaceView
that JavaFX uses. It will create aTextureView
that will be placed on the center of the screen, on top of the current view, taking the 95% of its width.With the Gluon plugin for your IDE, create a Single View Project.
com.gluonhq.charm.down.plugins
:VideoService interface
VideoServiceFactory class
com.gluonhq.charm.down.plugins.android
:AndroidVideoService class
Place a video file in the android/assets folder, like
big_buck_bunny.mp4
, that can be downloaded from here.BasicView
Deploy on your Android device and test:
Note that the TextureView will be on top until you remove it by pressing the stop button.