Skip to content

Commit

Permalink
fix: don't require audio session when load plugin
Browse files Browse the repository at this point in the history
closes #219
  • Loading branch information
befovy committed May 1, 2020
1 parent 3effb83 commit 839ac6a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '8.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down Expand Up @@ -72,6 +72,8 @@ target 'Runner' do
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
# specPath = "#{path}/ios/#{name}.podspec"
# pod name, :path => specPath
end
end

Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ SPEC CHECKSUMS:
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9

PODFILE CHECKSUM: 3dbe063e9c90a5d7c9e4e76e70a821b9e2c1d271
PODFILE CHECKSUM: fadc781d566d6b5969b90bf56cfaab132d0f0962

COCOAPODS: 1.9.1
2 changes: 2 additions & 0 deletions ios/Classes/FijkPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ NS_ASSUME_NONNULL_BEGIN

- (instancetype)initWithRegistrar:(id<FlutterPluginRegistrar>)registrar;

- (instancetype)initJustTexture;

- (void)shutdown;

@end
Expand Down
11 changes: 11 additions & 0 deletions ios/Classes/FijkPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ @implementation FijkPlayer {

// static int debugLeak = 0;

- (instancetype)initJustTexture {
self = [super init];
if (self) {
int pid = atomic_fetch_add(&atomicId, 1);
_playerId = @(pid);
_pid = pid;
_vid = -1;
}
return self;
}

- (instancetype)initWithRegistrar:(id<FlutterPluginRegistrar>)registrar {
self = [super init];
if (self) {
Expand Down
3 changes: 2 additions & 1 deletion ios/Classes/FijkPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
FijkPlugin *instance = [[FijkPlugin alloc] initWithRegistrar:registrar];
_instance = instance;
[registrar addMethodCallDelegate:instance channel:channel];
FijkPlayer *player = [[FijkPlayer alloc] initWithRegistrar:registrar];

FijkPlayer *player = [[FijkPlayer alloc] initJustTexture];
int64_t vid = [[registrar textures] registerTexture:player];
[player shutdown];
[[registrar textures] unregisterTexture:vid];
Expand Down

0 comments on commit 839ac6a

Please sign in to comment.