Search in sources :

Example 16 with WritableMap

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);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

Example 17 with WritableMap

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);
            }
        }
    }
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

Example 18 with WritableMap

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);
    }
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

Example 19 with WritableMap

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);
    }
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

Example 20 with WritableMap

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);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) Bundle(android.os.Bundle) Activity(android.app.Activity) Intent(android.content.Intent) ReactMethod(com.facebook.react.bridge.ReactMethod)

Aggregations

WritableMap (com.facebook.react.bridge.WritableMap)54 ReactContext (com.facebook.react.bridge.ReactContext)5 ThemedReactContext (com.facebook.react.uimanager.ThemedReactContext)4 Intent (android.content.Intent)3 WritableNativeMap (com.facebook.react.bridge.WritableNativeMap)3 RCTEventEmitter (com.facebook.react.uimanager.events.RCTEventEmitter)3 IOException (java.io.IOException)3 BroadcastReceiver (android.content.BroadcastReceiver)2 Context (android.content.Context)2 IntentFilter (android.content.IntentFilter)2 MediaMetadataRetriever (android.media.MediaMetadataRetriever)2 Bundle (android.os.Bundle)2 View (android.view.View)2 Callback (com.facebook.react.bridge.Callback)2 ReactApplicationContext (com.facebook.react.bridge.ReactApplicationContext)2 ReadableMap (com.facebook.react.bridge.ReadableMap)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 JSONArray (org.json.JSONArray)2 JSONObject (org.json.JSONObject)2