use of com.facebook.react.bridge.WritableMap in project react-native-android-video-editor by RZulfikri.
the class VideoSurfaceView method onCompletion.
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
// Log.e("DEBUG", "MEDIA PLAYER COMPLETE");
WritableMap event = Arguments.createMap();
event.putBoolean(Events.VIDEO_COMPLETED, true);
eventEmitter.receiveEvent(getId(), EventsEnum.EVENT_GET_VIDEO_COMPLETED.toString(), event);
}
use of com.facebook.react.bridge.WritableMap in project react-native-android-video-editor by RZulfikri.
the class VideoThumbnail method setXpos.
public void setXpos(int xpos) {
// Log.e("DEBUG", "INI "+xpos);
if (this.xpos != xpos) {
this.xpos = xpos;
}
if (startDur == 0 && endDur <= startDur) {
int duration = videoPlayerSeek.getDuration();
if (this.xpos >= layoutHeight / 2 && this.xpos <= usedWidth - layoutHeight / 2) {
seekDur = ((duration * (this.xpos - (layoutHeight / 2))) / (usedWidth - layoutHeight));
if (seekDur >= 0 && seekDur <= videoPlayerSeek.getDuration()) {
videoPlayerSeek.setX(xpos - (layoutHeight / 2));
videoPlayerSeek.seekTo(seekDur);
WritableMap event = Arguments.createMap();
event.putInt(Events.SEEK_POS, seekDur);
eventEmitter.receiveEvent(getId(), EventsEnum.EVENT_GET_SEEK_POS.toString(), event);
// videoPlayerView.seekTo(seekDur);
}
}
} else {
int duration = endDur - startDur;
if (this.xpos >= layoutHeight / 2 && this.xpos <= usedWidth - layoutHeight / 2) {
seekDur = Math.round((duration * (float) (this.xpos - (layoutHeight / 2))) / (float) (usedWidth - layoutHeight));
if (seekDur >= 0 && seekDur <= duration) {
videoPlayerSeek.setX(xpos - (layoutHeight / 2));
videoPlayerSeek.seekTo(seekDur + startDur);
WritableMap event = Arguments.createMap();
event.putInt(Events.SEEK_POS, seekDur);
eventEmitter.receiveEvent(getId(), EventsEnum.EVENT_GET_SEEK_POS.toString(), event);
// videoPlayerView.seekTo(seekDur + startDur);
}
}
}
}
use of com.facebook.react.bridge.WritableMap in project react-native-android-video-editor by RZulfikri.
the class VideoSurfaceView method playVideo.
public void playVideo() {
if (!mMediaPlayer.isPlaying()) {
mMediaPlayer.start();
mMessageHandler.sendEmptyMessage(SHOW_PROGRESS);
WritableMap event = Arguments.createMap();
event.putBoolean(Events.VIDEO_PLAYER_STATUS, true);
eventEmitter.receiveEvent(getId(), EventsEnum.EVENT_GET_VIDEO_PLAYER_STATUS.toString(), event);
}
}
use of com.facebook.react.bridge.WritableMap in project react-native-android-video-editor by RZulfikri.
the class VideoSurfaceView method pauseVideo.
public void pauseVideo() {
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.pause();
mMessageHandler.removeMessages(SHOW_PROGRESS);
WritableMap event = Arguments.createMap();
event.putBoolean(Events.VIDEO_PLAYER_STATUS, false);
eventEmitter.receiveEvent(getId(), EventsEnum.EVENT_GET_VIDEO_PLAYER_STATUS.toString(), event);
}
}
use of com.facebook.react.bridge.WritableMap in project react-native-push-notification by zo0r.
the class RNPushNotification method getInitialNotification.
@ReactMethod
public void getInitialNotification(Promise promise) {
WritableMap params = Arguments.createMap();
Activity activity = getCurrentActivity();
if (activity != null) {
Intent intent = activity.getIntent();
Bundle bundle = intent.getBundleExtra("notification");
if (bundle != null) {
bundle.putBoolean("foreground", false);
String bundleString = mJsDelivery.convertJSON(bundle);
params.putString("dataJSON", bundleString);
}
}
promise.resolve(params);
}
Aggregations