Webhooks and Events - Flutter
Event associated with Recording
- recordingStateChanged - Whenever Livestream recording state changes, then 
recordingStateChangedevent will trigger. 
import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';
class LivestreamScreen extends StatefulWidget {
  ...
}
class _LivestreamScreenState extends State<LivestreamScreen> {
  late Room room;
  @override
  void initState() {
    ...
    setupRoomEventListener();
  }
  @override
  Widget build(BuildContext context) {
    return YourLivestreamWidget();
  }
  void setupRoomEventListener() {
    room.on(Events.recordingStateChanged, (String status) {
      //Status can be :: RECORDING_STARTING
      //Status can be :: RECORDING_STARTED
      //Status can be :: RECORDING_STOPPING
      //Status can be :: RECORDING_STOPPED
      log("Livestream Recording status : $status");
    });
  }
}
Webhook associated with Recording
recording-starting
- A "Recording Starting" webhook is triggered when the recording process for a Livestream is initiated.
 
Example
{
    "webhookType": "recording-starting",
    "data": {
        "LivestreamId": "jvsg-8rjn-j304",
        "sessionId": "613731342f27f56e4fc4b6d0",
    },
}
recording-started
- Recording started webhook will be received when successfully recording is started in Livestream
 
Example
{
    "webhookType": "recording-started",
    "data": {
        "LivestreamId": "jvsg-8rjn-j304",
        "sessionId": "613731342f27f56e4fc4b6d0",
    },
}
recording-stopping
- A "Recording Stopping" webhook is triggered when the recording end process for a Livestream is initiated.
 
Example
{
    "webhookType": "recording-stopping",
    "data": {
        "LivestreamId": "jvsg-8rjn-j304",
        "sessionId": "613731342f27f56e4fc4b6d0",
    },
}
recording-stopped
- Recording stopped webhook will be received when recording is successfully stopped in Livestream.
 
Example
{
    "webhookType": "recording-stopped",
    "data": {
        "LivestreamId": "jvsg-8rjn-j304",
        "sessionId": "613731342f27f56e4fc4b6d0",
        "filePath" : "/encoded/videos/62d148951a1eb20029fc9b05.mp4",
        "fileUrl" : "https://cdn.videosdk.live/encoded/videos/62d148951a1eb20029fc9b05.mp4",
    },
}
recording-failed
- A "Recording Failed" webhook is generated when the recording process encounters an interruption or issue during either the starting or stopping phases.
 
Example
{
    "webhookType": "recording-failed",
    "data": {
        "LivestreamId": "jvsg-8rjn-j304",
        "sessionId": "613731342f27f56e4fc4b6d0",
    },
}
Got a Question? Ask us on discord

