Disable setCategory on macOS
This commit is contained in:
parent
e89417119c
commit
122a90b4fb
18
README.md
18
README.md
|
@ -12,19 +12,19 @@ A Flutter plugin to play audio from URLs, files, assets, DASH/HLS streams and pl
|
||||||
| request headers | ✅ | ✅ | ✅ | |
|
| request headers | ✅ | ✅ | ✅ | |
|
||||||
| DASH | ✅ | (untested) | (untested) | (untested) |
|
| DASH | ✅ | (untested) | (untested) | (untested) |
|
||||||
| HLS | ✅ | ✅ | (untested) | (untested) |
|
| HLS | ✅ | ✅ | (untested) | (untested) |
|
||||||
| buffer status/position | ✅ | ✅ | (untested) | ✅ |
|
| buffer status/position | ✅ | ✅ | ✅ | ✅ |
|
||||||
| play/pause/seek | ✅ | ✅ | ✅ | ✅ |
|
| play/pause/seek | ✅ | ✅ | ✅ | ✅ |
|
||||||
| set volume | ✅ | ✅ | (untested) | ✅ |
|
| set volume | ✅ | ✅ | ✅ | ✅ |
|
||||||
| set speed | ✅ | ✅ | ✅ | ✅ |
|
| set speed | ✅ | ✅ | ✅ | ✅ |
|
||||||
| clip audio | ✅ | ✅ | (untested) | ✅ |
|
| clip audio | ✅ | ✅ | ✅ | ✅ |
|
||||||
| playlists | ✅ | ✅ | (untested) | ✅ |
|
| playlists | ✅ | ✅ | ✅ | ✅ |
|
||||||
| looping | ✅ | ✅ | (untested) | ✅ |
|
| looping | ✅ | ✅ | ✅ | ✅ |
|
||||||
| shuffle | ✅ | ✅ | (untested) | ✅ |
|
| shuffle | ✅ | ✅ | ✅ | ✅ |
|
||||||
| compose audio | ✅ | ✅ | (untested) | ✅ |
|
| compose audio | ✅ | ✅ | ✅ | ✅ |
|
||||||
| gapless playback | ✅ | ✅ | (untested) | |
|
| gapless playback | ✅ | ✅ | ✅ | |
|
||||||
| report player errors | ✅ | ✅ | ✅ | ✅ |
|
| report player errors | ✅ | ✅ | ✅ | ✅ |
|
||||||
|
|
||||||
This plugin has been tested on Android, iOS and Web, and is being made available for testing on MacOS. Please consider reporting any bugs you encounter [here](https://github.com/ryanheise/just_audio/issues) or submitting pull requests [here](https://github.com/ryanheise/just_audio/pulls).
|
Please consider reporting any bugs you encounter [here](https://github.com/ryanheise/just_audio/issues) or submitting pull requests [here](https://github.com/ryanheise/just_audio/pulls).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#import "ClippingAudioSource.h"
|
#import "ClippingAudioSource.h"
|
||||||
#import <AVFoundation/AVFoundation.h>
|
#import <AVFoundation/AVFoundation.h>
|
||||||
#import <stdlib.h>
|
#import <stdlib.h>
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
|
||||||
// TODO: Check for and report invalid state transitions.
|
// TODO: Check for and report invalid state transitions.
|
||||||
// TODO: Apply Apple's guidance on seeking: https://developer.apple.com/library/archive/qa/qa1820/_index.html
|
// TODO: Apply Apple's guidance on seeking: https://developer.apple.com/library/archive/qa/qa1820/_index.html
|
||||||
|
@ -865,9 +866,11 @@
|
||||||
_playResult = result;
|
_playResult = result;
|
||||||
}
|
}
|
||||||
_playing = YES;
|
_playing = YES;
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
if (_configuredSession) {
|
if (_configuredSession) {
|
||||||
[[AVAudioSession sharedInstance] setActive:YES error:nil];
|
[[AVAudioSession sharedInstance] setActive:YES error:nil];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
[_player play];
|
[_player play];
|
||||||
[self updatePosition];
|
[self updatePosition];
|
||||||
if (@available(macOS 10.12, iOS 10.0, *)) {}
|
if (@available(macOS 10.12, iOS 10.0, *)) {}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#import "JustAudioPlugin.h"
|
#import "JustAudioPlugin.h"
|
||||||
#import "AudioPlayer.h"
|
#import "AudioPlayer.h"
|
||||||
#import <AVFoundation/AVFoundation.h>
|
#import <AVFoundation/AVFoundation.h>
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
|
||||||
@implementation JustAudioPlugin {
|
@implementation JustAudioPlugin {
|
||||||
NSObject<FlutterPluginRegistrar>* _registrar;
|
NSObject<FlutterPluginRegistrar>* _registrar;
|
||||||
|
@ -29,6 +30,7 @@
|
||||||
/*AudioPlayer* player =*/ [[AudioPlayer alloc] initWithRegistrar:_registrar playerId:playerId configuredSession:_configuredSession];
|
/*AudioPlayer* player =*/ [[AudioPlayer alloc] initWithRegistrar:_registrar playerId:playerId configuredSession:_configuredSession];
|
||||||
result(nil);
|
result(nil);
|
||||||
} else if ([@"setIosCategory" isEqualToString:call.method]) {
|
} else if ([@"setIosCategory" isEqualToString:call.method]) {
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
NSNumber* categoryIndex = (NSNumber*)call.arguments;
|
NSNumber* categoryIndex = (NSNumber*)call.arguments;
|
||||||
AVAudioSessionCategory category = nil;
|
AVAudioSessionCategory category = nil;
|
||||||
switch (categoryIndex.integerValue) {
|
switch (categoryIndex.integerValue) {
|
||||||
|
@ -43,6 +45,7 @@
|
||||||
_configuredSession = YES;
|
_configuredSession = YES;
|
||||||
}
|
}
|
||||||
[[AVAudioSession sharedInstance] setCategory:category error:nil];
|
[[AVAudioSession sharedInstance] setCategory:category error:nil];
|
||||||
|
#endif
|
||||||
result(nil);
|
result(nil);
|
||||||
} else {
|
} else {
|
||||||
result(FlutterMethodNotImplemented);
|
result(FlutterMethodNotImplemented);
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import path_provider_macos
|
||||||
import just_audio
|
import just_audio
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,32 @@ PODS:
|
||||||
- FlutterMacOS (1.0.0)
|
- FlutterMacOS (1.0.0)
|
||||||
- just_audio (0.0.1):
|
- just_audio (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
- path_provider (0.0.1)
|
||||||
|
- path_provider_macos (0.0.1):
|
||||||
|
- FlutterMacOS
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64`)
|
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64`)
|
||||||
- just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`)
|
- just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`)
|
||||||
|
- path_provider (from `Flutter/ephemeral/.symlinks/plugins/path_provider/macos`)
|
||||||
|
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
FlutterMacOS:
|
FlutterMacOS:
|
||||||
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64
|
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64
|
||||||
just_audio:
|
just_audio:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/just_audio/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/just_audio/macos
|
||||||
|
path_provider:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/path_provider/macos
|
||||||
|
path_provider_macos:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9
|
FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9
|
||||||
just_audio: 1a11463e7e522bd4e8caa925b4247f1360cbe5a2
|
just_audio: 1a11463e7e522bd4e8caa925b4247f1360cbe5a2
|
||||||
|
path_provider: e0848572d1d38b9a7dd099e79cf83f5b7e2cde9f
|
||||||
|
path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b
|
||||||
|
|
||||||
PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7
|
PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7
|
||||||
|
|
||||||
COCOAPODS: 1.7.5
|
COCOAPODS: 1.9.3
|
||||||
|
|
|
@ -21,7 +21,7 @@ packages:
|
||||||
name: characters
|
name: characters
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.1.0-nullsafety"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -42,7 +42,7 @@ packages:
|
||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.14.13"
|
version: "1.15.0-nullsafety"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -120,7 +120,7 @@ packages:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.8"
|
version: "1.3.0-nullsafety"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -237,7 +237,7 @@ packages:
|
||||||
name: typed_data
|
name: typed_data
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.3.0-nullsafety"
|
||||||
uuid:
|
uuid:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -251,7 +251,7 @@ packages:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.8"
|
version: "2.1.0-nullsafety"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -260,5 +260,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.0"
|
version: "0.1.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.9.0-14.0.dev <3.0.0"
|
dart: ">=2.9.0-18.0 <2.9.0"
|
||||||
flutter: ">=1.12.13+hotfix.5 <2.0.0"
|
flutter: ">=1.12.13+hotfix.5 <2.0.0"
|
||||||
|
|
Loading…
Reference in New Issue