-
-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathpigeon_conf.dart
executable file
·149 lines (117 loc) · 2.67 KB
/
pigeon_conf.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import 'package:pigeon/pigeon.dart';
// to build the classes: flutter pub run pigeon --input pigeon_conf.dart
// #docregion config
@ConfigurePigeon(PigeonOptions(
dartOut: 'lib/src/audio_pigeon.g.dart',
dartOptions: DartOptions(),
kotlinOut:
'android/app/src/main/kotlin/meditofoundation/medito/AudioPigeon.g.kt',
kotlinOptions: KotlinOptions(),
))
// #enddocregion config
// #docregion host-definitions
//ignore:prefer-match-file-name
class AudioData {
AudioData({
required this.url,
required this.track,
});
String url;
Track track;
}
@HostApi()
abstract class MeditoAndroidAudioServiceManager {
void startService();
}
@HostApi()
abstract class MeditoAudioServiceApi {
bool playAudio(AudioData audioData);
void playPauseAudio();
void stopAudio();
void setSpeed(double speed);
void seekToPosition(int position);
void skip10SecondsForward();
void skip10SecondsBackward();
void setBackgroundSound(String? uri);
void setBackgroundSoundVolume(double volume);
void stopBackgroundSound();
void playBackgroundSound();
void pauseBackgroundSound();
}
// #enddocregion host-definitions
// #docregion flutter-definitions
class PlaybackState {
bool isPlaying;
bool isBuffering;
bool isSeeking;
bool isCompleted;
int position;
int duration;
Speed speed;
int volume;
Track track;
BackgroundSound? backgroundSound;
PlaybackState({
required this.isPlaying,
required this.isBuffering,
required this.isSeeking,
required this.isCompleted,
required this.position,
required this.duration,
required this.speed,
required this.volume,
required this.track,
this.backgroundSound,
});
}
class BackgroundSound {
String? uri;
String title;
BackgroundSound({
required this.uri,
required this.title,
});
}
class Speed {
double speed;
Speed({required this.speed});
}
class Track {
String id;
String title;
String description;
String imageUrl;
String? artist;
String? artistUrl;
Track({
required this.id,
required this.title,
required this.description,
required this.imageUrl,
required this.artist,
this.artistUrl,
});
}
class CompletionData {
String trackId;
int duration;
String fileId;
String? guideId;
int timestamp;
String? userToken;
CompletionData({
required this.trackId,
required this.duration,
required this.fileId,
required this.guideId,
required this.timestamp,
required this.userToken,
});
}
@FlutterApi()
abstract class MeditoAudioServiceCallbackApi {
void updatePlaybackState(PlaybackState state);
@async
bool handleCompletedTrack(CompletionData completionData);
}
// #enddocregion flutter-definitions