-
-
Notifications
You must be signed in to change notification settings - Fork 100
/
pigeon_conf.dart
128 lines (99 loc) · 2.34 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
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/com/meditofoundation/medito/AudioPigeon.g.kt',
kotlinOptions: KotlinOptions(),
// swiftOut: 'ios/Runner/Messages.g.swift',
// swiftOptions: SwiftOptions(),
))
// #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 title;
String description;
String imageUrl;
String? artist;
String? artistUrl;
Track({
required this.title,
required this.description,
required this.imageUrl,
required this.artist,
this.artistUrl,
});
}
@FlutterApi()
abstract class MeditoAudioServiceCallbackApi {
void updatePlaybackState(PlaybackState state);
}
// #enddocregion flutter-definitions