public class ExoPlayer extends ViewWrapper<EMVideoView> {
/*
* XML wrapper
* Extract funtions in xml file
*/
public static void LIBRARY_DOC() {}
/*
* Initialize the ExoPlayer object to B4A
*/
@Override
public void Initialize(BA paramBA, String paramString)
{
super.Initialize(paramBA, paramString);
}
/*
* Wrap the ExoPlayer view to B4A view
*/
@Override
@BA.Hide
public void innerInitialize(final BA pBA, final String pEventName, boolean pKeepOldObject)
{
if (!pKeepOldObject)
{
EMVideoView VideoView = new EMVideoView(pBA.context);
if (pBA.subExists(pEventName + "_Prepared")) {
VideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
{
public void onPrepared(android.media.MediaPlayer arg0)
{
pBA.raiseEvent(ExoPlayer.this, pEventName + "_Prepared", new Object[0]);
}
});
} else {
Log.e("B4A", "Sub Does Not Exists..." +(pEventName + "_Prepared"));
}
setObject(VideoView);
}
super.innerInitialize(pBA, pEventName, true);
}
/*
* Sets the path to the video
* This path can be a web address (e.g. http://) or an absolute local path (e.g. file://)
* @param: path - The path to the video
*/
public void SetVideoPath(String VideoPath) {
((EMVideoView)getObject()).setVideoPath(VideoPath);
}
/*
* Starts or resumes playback
*/
public void Start() {
((EMVideoView)getObject()).start();
}
/*
* Enables and disables the media control overlay for the video view
* @param: enabled - Weather the default video controls are enabled (default: false)
*/
public void SetDefaultControlsEnabled(boolean Enabled) {
((EMVideoView)getObject()).setDefaultControlsEnabled(Enabled);
}
}