Skip to content

Commit

Permalink
Merge branch 'canxin121-minor' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed May 26, 2024
2 parents 173c0d1 + 63a52fa commit 782978c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 13 deletions.
4 changes: 4 additions & 0 deletions just_audio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.39

* Apply preferPreciseDurationAndTiming to files (@canxin121).

## 0.9.38

* Migrate to package:web.
Expand Down
22 changes: 13 additions & 9 deletions just_audio/darwin/Classes/UriAudioSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,20 @@ - (NSString *)uri {

- (IndexedPlayerItem *)createPlayerItem:(NSString *)uri {
IndexedPlayerItem *item;
NSMutableDictionary *assetOptions = [[NSMutableDictionary alloc] init];

if (_options != (id)[NSNull null]) {
NSDictionary *darwinOptions = _options[@"darwinAssetOptions"];
if (darwinOptions != (id)[NSNull null]) {
assetOptions[AVURLAssetPreferPreciseDurationAndTimingKey] = darwinOptions[@"preferPreciseDurationAndTiming"];
}
}

if ([uri hasPrefix:@"file://"]) {
item = [[IndexedPlayerItem alloc] initWithURL:[NSURL fileURLWithPath:[[uri stringByRemovingPercentEncoding] substringFromIndex:7]]];
NSURL *fileURL = [NSURL fileURLWithPath:[[uri stringByRemovingPercentEncoding] substringFromIndex:7]];
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:fileURL options:assetOptions];
item = [[IndexedPlayerItem alloc] initWithAsset:asset];
} else {
NSMutableDictionary *assetOptions = [[NSMutableDictionary alloc] init];
if (_headers) {
// Use user-agent key if it is the only header and the API is supported.
if ([_headers count] == 1) {
Expand All @@ -58,13 +68,7 @@ - (IndexedPlayerItem *)createPlayerItem:(NSString *)uri {
assetOptions[@"AVURLAssetHTTPHeaderFieldsKey"] = _headers;
}
}
if (_options != (id)[NSNull null]) {
NSDictionary *darwinOptions = _options[@"darwinAssetOptions"];
if (darwinOptions != (id)[NSNull null]) {
assetOptions[AVURLAssetPreferPreciseDurationAndTimingKey] = darwinOptions[@"preferPreciseDurationAndTiming"];
}
}


AVURLAsset *asset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:uri] options:assetOptions];
item = [[IndexedPlayerItem alloc] initWithAsset:asset];
}
Expand Down
34 changes: 31 additions & 3 deletions just_audio/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
E3D27207363A6BEE407ADF2D /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -261,6 +262,24 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
E3D27207363A6BEE407ADF2D /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/path_provider_foundation/path_provider_foundation_privacy.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/path_provider_foundation_privacy.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -358,7 +377,10 @@
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down Expand Up @@ -486,7 +508,10 @@
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand All @@ -510,7 +535,10 @@
);
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down
2 changes: 1 addition & 1 deletion just_audio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: just_audio
description: A feature-rich audio player for Flutter. Loop, clip and concatenate any sound from any source (asset/file/URL/stream) in a variety of audio formats with gapless playback.
version: 0.9.38
version: 0.9.39
repository: https://github.com/ryanheise/just_audio/tree/minor/just_audio
issue_tracker: https://github.com/ryanheise/just_audio/issues
topics:
Expand Down

0 comments on commit 782978c

Please sign in to comment.