Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transcription feature added #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,30 +11,20 @@ if (localPropertiesFile.exists()) {
}
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') ?: '1'
def flutterVersionName = localProperties.getProperty('flutter.versionName') ?: '1.0'

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
Expand All @@ -40,14 +35,18 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "live.videosdk.rtc.flutter"
minSdkVersion 23
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
Expand All @@ -59,9 +58,7 @@ android {

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about that?

}
}
}
Expand Down
4 changes: 4 additions & 0 deletions assets/transcription.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
98 changes: 86 additions & 12 deletions lib/screens/conference-call/conference_meeting_screen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:developer';
import 'dart:io';

import 'package:flutter/foundation.dart';
Expand Down Expand Up @@ -41,6 +42,7 @@ class _ConfereneceMeetingScreenState extends State<ConfereneceMeetingScreen> {
bool isRecordingOn = false;
bool showChatSnackbar = true;
String recordingState = "RECORDING_STOPPED";
String transcriptionState = "TRANSCRIPTION_STOPPED";
// Meeting
late Room meeting;
bool _joined = false;
Expand Down Expand Up @@ -113,6 +115,7 @@ class _ConfereneceMeetingScreenState extends State<ConfereneceMeetingScreen> {
meeting: meeting,
token: widget.token,
recordingState: recordingState,
transcriptionState: transcriptionState,
isMicEnabled: audioStream != null,
isCamEnabled: videoStream != null,
isLocalScreenShareEnabled: shareStream != null,
Expand All @@ -123,6 +126,7 @@ class _ConfereneceMeetingScreenState extends State<ConfereneceMeetingScreen> {
meeting: meeting,
token: widget.token,
recordingState: recordingState,
transcriptionState: transcriptionState,
isFullScreen: fullScreen,
),
const Divider(),
Expand Down Expand Up @@ -164,6 +168,7 @@ class _ConfereneceMeetingScreenState extends State<ConfereneceMeetingScreen> {
isCamEnabled: videoStream != null,
isScreenShareEnabled: shareStream != null,
recordingState: recordingState,
transcriptionState: transcriptionState,
// Called when Call End button is pressed
onCallEndButtonPressed: () {
meeting.end();
Expand Down Expand Up @@ -262,25 +267,70 @@ class _ConfereneceMeetingScreenState extends State<ConfereneceMeetingScreen> {
context: context);
}
} else if (option == "recording") {
if (recordingState ==
"RECORDING_STOPPING") {
if (recordingState == "RECORDING_STOPPING") {
showSnackBarMessage(
message:
"Recording is in stopping state",
message: "Recording is in stopping state",
context: context);
} else if (recordingState ==
"RECORDING_STARTED") {
} else if (recordingState == "RECORDING_STARTED") {
meeting.stopRecording();
} else if (recordingState ==
"RECORDING_STARTING") {
} else if (recordingState == "RECORDING_STARTING") {
showSnackBarMessage(
message:
"Recording is in starting state",
message: "Recording is in starting state",
context: context);
} else {
// Define the config and transcription maps
Map<String, dynamic> config = {
"layout": {
"type": "GRID",
"priority": "SPEAKER",
"gridSize": 4,
},
"theme": "DARK",
"mode": "video-and-audio",
"quality": "high",
"orientation": "landscape",
};

Map<String, dynamic> transcription = {
"enabled": true,
"summary": {
"enabled": true,
"prompt": "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary",
},
};

// Start recording with the defined config and transcription
meeting.startRecording(config: config, transcription: transcription);
}
}

else if (option == "transcription") {
if (transcriptionState == "TRANSCRIPTION_STOPPING") {
showSnackBarMessage(
message: "Transcription is in stopping state",
context: context);
} else if (transcriptionState == "TRANSCRIPTION_STARTED") {
meeting.stopTranscription();
} else if (transcriptionState == "TRANSCRIPTION_STARTING") {
showSnackBarMessage(
message: "TRANSCRIPTION is in starting state",
context: context);
} else {
meeting.startRecording();
Map<String, dynamic> config = {
"webhookUrl": "https://webhook.your-api-server.com",
"summary": {
"enabled": true,
"prompt":
"Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary",
}
};

// Start recording with the defined config and transcription
meeting.startTranscription(config: config);
}
} else if (option == "participants") {
}

else if (option == "participants") {
showModalBottomSheet(
context: context,
isScrollControlled: false,
Expand Down Expand Up @@ -338,6 +388,30 @@ class _ConfereneceMeetingScreenState extends State<ConfereneceMeetingScreen> {
});
});

_meeting.on(Events.transcriptionStateChanged, (Map<String, dynamic> data) {
String status = data['status'];

showSnackBarMessage(
message:
"Transcription ${status == "TRANSCRIPTION_STARTING" ? "is starting" : status == "TRANSCRIPTION_STARTED" ? "started" : status == "TRANSCRIPTION_STOPPING" ? "is stopping" : "stopped"}",
context: context,
);

setState(() {
transcriptionState = status;
});
});

_meeting.on(Events.transcriptionText, (Map<String, dynamic> data) {
String participantName = data['participantName'];
String text = data['text'];
int timestamp = data['timestamp'];

log("$participantName: $text $timestamp");
});



// Called when stream is enabled
_meeting.localParticipant.on(Events.streamEnabled, (Stream _stream) {
if (_stream.kind == 'video') {
Expand Down
Loading