Skip to content
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
5 changes: 5 additions & 0 deletions obs_flutter/obs/obs_demo/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ android {
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

configurations {
implementation.exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}


compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:label="obs_demo"
android:name="${applicationName}"
Expand Down
90 changes: 90 additions & 0 deletions obs_flutter/obs/obs_demo/lib/audio_bubble.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import 'package:flutter/material.dart';
import 'package:audio_waveforms/audio_waveforms.dart';

class AudioBubble extends StatelessWidget {
final String? recordedFilePath;
final RecorderController? recorderController;
final PlayerController? playerController;
final int currentPositionInSeconds;

const AudioBubble({
Key? key,
this.recordedFilePath,
this.recorderController,
this.playerController,
required this.currentPositionInSeconds,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10),
margin: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color.fromARGB(255, 92, 91, 95),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
if (recordedFilePath != null && recorderController != null)
Column(
children: [
AudioWaveforms(
enableGesture: true,
size: Size(MediaQuery.of(context).size.width / 1.08, 80),
recorderController: recorderController!,
waveStyle: WaveStyle(
waveColor: Colors.white,
extendWaveform: true,
showDurationLabel: true),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
color: const Color(0xFF1E1B26),
),
padding: const EdgeInsets.only(left: 18),
margin: const EdgeInsets.symmetric(horizontal: 15),
),
SizedBox(height: 8),
// Text(
// _formatDuration(Duration(seconds: currentPositionInSeconds)),
// style: TextStyle(color: Colors.white),
// ),
],
),
if (recordedFilePath != null && playerController != null)
Column(
children: [
AudioFileWaveforms(
size: Size(MediaQuery.of(context).size.width, 80),
enableSeekGesture: true,
waveformType: WaveformType.long,
playerController: playerController!,
playerWaveStyle: const PlayerWaveStyle(
scaleFactor: 0.8,
fixedWaveColor: Colors.white54,
liveWaveColor: Colors.blueAccent,
// spacing: 6,
waveCap: StrokeCap.butt,
),
),
SizedBox(height: 8),
// Text(
// _formatDuration(Duration(seconds: currentPositionInSeconds)),
// style: TextStyle(color: Colors.white),
// ),
],
),
],
),
);
}

String _formatDuration(Duration duration) {
String twoDigits(int n) => n.toString().padLeft(2, "0");
String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60));
String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60));
return "$twoDigitMinutes:$twoDigitSeconds";
}
}
Loading