Search in sources :

Example 36 with WritableMap

use of com.facebook.react.bridge.WritableMap in project react-native-video by react-native-community.

the class VideoEventEmitter method error.

void error(String errorString, Exception exception) {
    WritableMap error = Arguments.createMap();
    error.putString(EVENT_PROP_ERROR_STRING, errorString);
    error.putString(EVENT_PROP_ERROR_EXCEPTION, exception.getMessage());
    WritableMap event = Arguments.createMap();
    event.putMap(EVENT_PROP_ERROR, error);
    receiveEvent(EVENT_ERROR, event);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

Example 37 with WritableMap

use of com.facebook.react.bridge.WritableMap in project react-native-video by react-native-community.

the class VideoEventEmitter method progressChanged.

void progressChanged(double currentPosition, double bufferedDuration) {
    WritableMap event = Arguments.createMap();
    event.putDouble(EVENT_PROP_CURRENT_TIME, currentPosition / 1000D);
    event.putDouble(EVENT_PROP_PLAYABLE_DURATION, bufferedDuration / 1000D);
    receiveEvent(EVENT_PROGRESS, event);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

Example 38 with WritableMap

use of com.facebook.react.bridge.WritableMap in project react-native-video by react-native-community.

the class VideoEventEmitter method buffering.

void buffering(boolean isBuffering) {
    WritableMap map = Arguments.createMap();
    map.putBoolean(EVENT_PROP_IS_BUFFERING, isBuffering);
    receiveEvent(EVENT_BUFFER, map);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

Example 39 with WritableMap

use of com.facebook.react.bridge.WritableMap in project react-native-video by react-native-community.

the class ReactVideoView method seekTo.

@Override
public void seekTo(int msec) {
    if (mMediaPlayerValid) {
        WritableMap event = Arguments.createMap();
        event.putDouble(EVENT_PROP_CURRENT_TIME, getCurrentPosition() / 1000.0);
        event.putDouble(EVENT_PROP_SEEK_TIME, msec / 1000.0);
        mEventEmitter.receiveEvent(getId(), Events.EVENT_SEEK.toString(), event);
        super.seekTo(msec);
        if (isCompleted && mVideoDuration != 0 && msec < mVideoDuration) {
            isCompleted = false;
        }
    }
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

Example 40 with WritableMap

use of com.facebook.react.bridge.WritableMap in project react-native-video by react-native-community.

the class ReactVideoView method onError.

@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    WritableMap error = Arguments.createMap();
    error.putInt(EVENT_PROP_WHAT, what);
    error.putInt(EVENT_PROP_EXTRA, extra);
    WritableMap event = Arguments.createMap();
    event.putMap(EVENT_PROP_ERROR, error);
    mEventEmitter.receiveEvent(getId(), Events.EVENT_ERROR.toString(), event);
    return true;
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap)

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