THEOplayer / react-native-connectors

THEOplayer React Native connectors
MIT License
3 stars 4 forks source link

Android compiles but does not send Mux data to Snowflake #118

Open davidwinograd1 opened 8 months ago

davidwinograd1 commented 8 months ago

Hello,

When using the @theoplayer/react-native-analytics-mux package, my code doesn't throw any errors (unlike the other iOS error), but it's been confirmed that the data itself from Mux is not being sent to Snowflake. Please let me know what might be causing this issue! @tvanlaerhoven

"@theoplayer/react-native-analytics-mux": "^1.2.0", "react-native-theoplayer": "^3.0.2",

Here is the code:

import {useMux} from '@theoplayer/react-native-analytics-mux';

const muxOptions = {
    debug: true,
    data: {
      env_key: MUX_ENV_KEY, // required

      // Site Metadata
      viewer_user_id: userId,

      // Player Metadata
      player_name: playerName,
      player_version: '3.0.1',
      player_init_time: Date.now(),

      // Video Metadata
      video_id: id,
      video_title: title,
      video_duration: player?.duration,
      video_stream_type: isLive ? 'live' : 'on-demand',
      video_producer: creatorId,
      page_type: 'watchpage',
    },
  };

  const [mux, initMux] = useMux(muxOptions);

  const onReady = (player) => {
    initMux(player);

    setPlayer(player);

   ...
  };

   <THEOplayerView config={playerConfig} onPlayerReady={onReady}>
tvanlaerhoven commented 8 months ago

Hey @davidwinograd1 do you see the heartbeat logs in your logcat?

2023-10-27 22:41:35.494 6176-6270 MuxStatsEventQueue com.theoplayer.mux.example D sending hb TrackableEvent: BaseQueryData: query: { "xid": "9138214f-8b9d-4e4c-879b-5df77613bc5e", "xwati": "39318",

The connector is open-source, so you could also set a breakpoint in the connector class and see what is going out:

https://github.com/THEOplayer/react-native-theoplayer-analytics/blob/main/mux/android/src/main/java/com/theoplayermux/ReactTHEOplayerMuxModule.kt#L76

Alternatively also check a network trace.

If data is going out, maybe the env_key is not correct?

davidwinograd1 commented 8 months ago

Hi @tvanlaerhoven,

The ENV_KEY is definitely correct because it works in another part of my application where I use React Native Video integrated with Mux.

In terms of the heartbeat logs, I don't believe I see them. For example, adb logcat | grep MuxStatsEventQueue does not return anything, and adb logcat | grep theoplayer shows the following screenshot below, but nothing related to mux. Is there a step I'm missing? The implementation as I've said before is above and the package is definitely installed.

Have other people been able to send data correctly using the instructions at this link? https://github.com/THEOplayer/react-native-theoplayer-analytics/blob/main/mux/README.md

Screenshot 2023-10-30 at 1 31 15 PM
tvanlaerhoven commented 8 months ago

Hey @davidwinograd1, yes if the debug flag is enabled like in the example app (https://github.com/THEOplayer/react-native-theoplayer-analytics/blob/main/mux/example/src/App.tsx#L31) you should see all heartbeat logs passing in the logcat output.

Did you try to run the example app (https://github.com/THEOplayer/react-native-theoplayer-analytics/blob/main/mux/example) and check the output here?

You should be able to put a breakpoint in the connector when running from Android Studio, and then check if it goes through the setup. That's the best method to see what's going on I think. Could it be the connector is unmounted from RN prematurely?

tvanlaerhoven commented 7 months ago

Hi @davidwinograd1 , did you make progress with this issue?