@@ -31,7 +31,7 @@ static int on_local_method_call(char *channel, struct platch_obj *object, Flutte
31
31
struct std_value * args , * tmp ;
32
32
const char * method ;
33
33
char * player_id , * mode ;
34
- int result = 1 ;
34
+ struct std_value result = STDNULL ;
35
35
int ok ;
36
36
37
37
(void ) responsehandle ;
@@ -75,8 +75,7 @@ static int on_local_method_call(char *channel, struct platch_obj *object, Flutte
75
75
audio_player_pause (player );
76
76
audio_player_set_position (player , 0 );
77
77
} else if (streq (method , "release" )) {
78
- audio_player_pause (player );
79
- audio_player_set_position (player , 0 );
78
+ audio_player_release (player );
80
79
} else if (streq (method , "seek" )) {
81
80
tmp = stdmap_get_str (args , "position" );
82
81
if (tmp == NULL || !STDVALUE_IS_INT (* tmp )) {
@@ -109,7 +108,7 @@ static int on_local_method_call(char *channel, struct platch_obj *object, Flutte
109
108
110
109
audio_player_set_source_url (player , url );
111
110
} else if (streq (method , "getDuration" )) {
112
- result = audio_player_get_duration (player );
111
+ result = STDINT64 ( audio_player_get_duration (player ) );
113
112
} else if (streq (method , "setVolume" )) {
114
113
tmp = stdmap_get_str (args , "volume" );
115
114
if (tmp != NULL && STDVALUE_IS_FLOAT (* tmp )) {
@@ -118,7 +117,7 @@ static int on_local_method_call(char *channel, struct platch_obj *object, Flutte
118
117
return platch_respond_illegal_arg_std (responsehandle , "Expected `arg['volume']` to be a float." );
119
118
}
120
119
} else if (streq (method , "getCurrentPosition" )) {
121
- result = audio_player_get_position (player );
120
+ result = STDINT64 ( audio_player_get_position (player ) );
122
121
} else if (streq (method , "setPlaybackRate" )) {
123
122
tmp = stdmap_get_str (args , "playbackRate" );
124
123
if (tmp != NULL && STDVALUE_IS_FLOAT (* tmp )) {
@@ -191,7 +190,7 @@ static int on_local_method_call(char *channel, struct platch_obj *object, Flutte
191
190
return platch_respond_not_implemented (responsehandle );
192
191
}
193
192
194
- return platch_respond_success_std (responsehandle , & STDINT64 ( result ) );
193
+ return platch_respond_success_std (responsehandle , & result );
195
194
}
196
195
197
196
static int on_global_method_call (char * channel , struct platch_obj * object , FlutterPlatformMessageResponseHandle * responsehandle ) {
0 commit comments