Kalyzee / react-native-gstreamer

React native Gstreamer Ios / Android.
49 stars 20 forks source link

The application hangs when console logging GstState old_state #17

Closed mjansrud closed 5 years ago

mjansrud commented 5 years ago

Hi.

The whole program hangs when i am trying to log GstState from the onStateChanged callback. I have

switch (old_state) {
      case GstState.VOID_PENDING:
        console.log("Pending");
        break;
      case GstState.NULL:
        console.log("Null");
        break;
      case GstState.READY:
        console.log("Ready");
        break;
      case GstState.PAUSED:
        console.log("Paused");
        break;
      case GstState.PLAYING:
        console.log("Playing");
        break;
      default:
        console.log("Unknown");
        break;
    }

, but i dont get any reasonable results. How can i check the status?

mjansrud commented 5 years ago

This fixed it:

  onStateChanged(_message) {
    const { old_state, new_state } = _message.nativeEvent;

    switch (new_state) {
      case GstState.VOID_PENDING:
        console.log("Pending");
        break;
      case GstState.NULL:
        console.log("Null");
        break;
      case GstState.READY:
        console.log("Ready");
        break;
      case GstState.PAUSED:
        console.log("Paused");
        break;
      case GstState.PLAYING:
        console.log("Playing");
        this.props.setVideoConnected(true);
        break;
      default:
        console.log("Unknown");
        break;
    }
  }