-
-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
135 changed files
with
4,977 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.9.0 | ||
|
||
* Update to support just_audio_background. | ||
|
||
## 0.8.1 | ||
|
||
* Fix update position bug on Android. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
just_audio/android/src/main/java/com/ryanheise/just_audio/BetterEventChannel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.ryanheise.just_audio; | ||
|
||
import io.flutter.plugin.common.BinaryMessenger; | ||
import io.flutter.plugin.common.EventChannel; | ||
import io.flutter.plugin.common.EventChannel.EventSink; | ||
|
||
public class BetterEventChannel implements EventSink { | ||
private EventSink eventSink; | ||
|
||
public BetterEventChannel(final BinaryMessenger messenger, final String id) { | ||
EventChannel eventChannel = new EventChannel(messenger, id); | ||
eventChannel.setStreamHandler(new EventChannel.StreamHandler() { | ||
@Override | ||
public void onListen(final Object arguments, final EventSink eventSink) { | ||
BetterEventChannel.this.eventSink = eventSink; | ||
} | ||
|
||
@Override | ||
public void onCancel(final Object arguments) { | ||
eventSink = null; | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void success(Object event) { | ||
if (eventSink != null) eventSink.success(event); | ||
} | ||
|
||
@Override | ||
public void error(String errorCode, String errorMessage, Object errorDetails) { | ||
if (eventSink != null) eventSink.error(errorCode, errorMessage, errorDetails); | ||
} | ||
|
||
@Override | ||
public void endOfStream() { | ||
if (eventSink != null) eventSink.endOfStream(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#import "BetterEventChannel.h" | ||
|
||
@implementation BetterEventChannel { | ||
FlutterEventChannel *_eventChannel; | ||
FlutterEventSink _eventSink; | ||
} | ||
|
||
- (instancetype)initWithName:(NSString*)name messenger:(NSObject<FlutterBinaryMessenger> *)messenger { | ||
self = [super init]; | ||
NSAssert(self, @"super init cannot be nil"); | ||
_eventChannel = | ||
[FlutterEventChannel eventChannelWithName:name binaryMessenger:messenger]; | ||
[_eventChannel setStreamHandler:self]; | ||
_eventSink = nil; | ||
return self; | ||
} | ||
|
||
- (FlutterError*)onListenWithArguments:(id)arguments eventSink:(FlutterEventSink)eventSink { | ||
_eventSink = eventSink; | ||
return nil; | ||
} | ||
|
||
- (FlutterError*)onCancelWithArguments:(id)arguments { | ||
_eventSink = nil; | ||
return nil; | ||
} | ||
|
||
- (void)sendEvent:(id)event { | ||
if (!_eventSink) return; | ||
_eventSink(event); | ||
} | ||
|
||
- (void)dispose { | ||
[_eventChannel setStreamHandler:nil]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.