Skip to content

Commit 118bbcc

Browse files
authored
Merge pull request #114 from kdroidFilter/update-dep
Update iOS support and dependency configurations
2 parents e31a083 + 7fa9c7c commit 118bbcc

File tree

11 files changed

+123
-32
lines changed

11 files changed

+123
-32
lines changed

README.MD

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ dependencies {
9292

9393
## 📊 Compatibility Table
9494

95-
| Library Version | Kotlin Version |
96-
|-----------------|----------------|
97-
| 0.7.10 | 2.1.21 |
98-
| 0.7.11 | 2.2.0 |
95+
| Library Version | Kotlin Version | Compose Version |
96+
|-----------------|----------------|-----------------|
97+
| 0.8.3 | 2.2.20 | 1.9.0 |
98+
| 0.7.11 | 2.2.0 | 1.8.2 |
99+
| 0.7.10 | 2.1.21 | 1.8.2 |
99100

100101
## 🚀 Getting Started
101102

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#Gradle
2-
org.gradle.jvmargs=-Xmx8G
2+
# Enable native access to avoid Java 21+ warnings from Gradle native-platform (System::load)
3+
org.gradle.jvmargs=-Xmx8G --enable-native-access=ALL-UNNAMED
34
org.gradle.caching=true
45
org.gradle.configuration-cache=true
56
org.gradle.daemon=true

gradle/libs.versions.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
androidcontextprovider = "1.0.1"
44
cocoapods = "1.9.0"
5-
filekit = "0.10.0"
5+
filekit = "0.11.0"
66
gst1JavaCore = "1.4.0"
7-
kermit = "2.0.6"
8-
kotlin = "2.2.10"
9-
agp = "8.9.3"
7+
kermit = "2.0.8"
8+
kotlin = "2.2.20"
9+
agp = "8.12.3"
1010
kotlinx-coroutines = "1.10.2"
1111
kotlinxBrowserWasmJs = "0.3"
1212
kotlinxDatetime = "0.7.1-0.6.x-compat"
13-
compose = "1.8.2"
14-
androidx-activityCompose = "1.10.1"
15-
media3Exoplayer = "1.7.1"
13+
compose = "1.9.0"
14+
androidx-activityCompose = "1.11.0"
15+
media3Exoplayer = "1.8.0"
1616
jna = "5.17.0"
17-
platformtoolsDarkmodedetector = "0.5.0"
17+
platformtoolsDarkmodedetector = "0.6.1"
1818
slf4jSimple = "2.0.17"
1919

2020

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Pod::Spec.new do |spec|
2+
spec.name = 'ComposeMediaPlayer'
3+
spec.version = 'null'
4+
spec.homepage = 'https://github.com/kdroidFilter/Compose-Media-Player'
5+
spec.source = { :http=> ''}
6+
spec.authors = ''
7+
spec.license = ''
8+
spec.summary = 'A multiplatform video player library for Compose applications'
9+
spec.vendored_frameworks = 'build/cocoapods/framework/ComposeMediaPlayer.framework'
10+
spec.libraries = 'c++'
11+
12+
13+
14+
if !Dir.exist?('build/cocoapods/framework/ComposeMediaPlayer.framework') || Dir.empty?('build/cocoapods/framework/ComposeMediaPlayer.framework')
15+
raise "
16+
17+
Kotlin framework 'ComposeMediaPlayer' doesn't exist yet, so a proper Xcode project can't be generated.
18+
'pod install' should be executed after running ':generateDummyFramework' Gradle task:
19+
20+
./gradlew :mediaplayer:generateDummyFramework
21+
22+
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
23+
end
24+
25+
spec.xcconfig = {
26+
'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
27+
}
28+
29+
spec.pod_target_xcconfig = {
30+
'KOTLIN_PROJECT_PATH' => ':mediaplayer',
31+
'PRODUCT_MODULE_NAME' => 'ComposeMediaPlayer',
32+
}
33+
34+
spec.script_phases = [
35+
{
36+
:name => 'Build ComposeMediaPlayer',
37+
:execution_position => :before_compile,
38+
:shell_path => '/bin/sh',
39+
:script => <<-SCRIPT
40+
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
41+
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
42+
exit 0
43+
fi
44+
set -ev
45+
REPO_ROOT="$PODS_TARGET_SRCROOT"
46+
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
47+
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
48+
-Pkotlin.native.cocoapods.archs="$ARCHS" \
49+
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
50+
SCRIPT
51+
}
52+
]
53+
spec.resources = ['build/compose/cocoapods/compose-resources']
54+
end

mediaplayer/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ kotlin {
135135

136136
android {
137137
namespace = "io.github.kdroidfilter.composemediaplayer"
138-
compileSdk = 35
138+
compileSdk = 36
139139

140140
defaultConfig {
141141
minSdk = 21

mediaplayer/src/commonMain/kotlin/io/github/kdroidfilter/composemediaplayer/subtitle/SubtitleDisplay.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import androidx.compose.ui.text.style.TextAlign
2121
import androidx.compose.ui.unit.dp
2222
import androidx.compose.ui.unit.sp
2323
import kotlinx.coroutines.delay
24-
import kotlinx.datetime.Clock
24+
import kotlin.time.TimeSource
2525

2626
/**
2727
* A composable function that displays subtitles.
@@ -104,12 +104,11 @@ fun AutoUpdatingSubtitleDisplay(
104104
// Periodically update display time when playing
105105
LaunchedEffect(isPlaying, currentTimeMs) {
106106
if (isPlaying) {
107-
var lastUpdateTime = Clock.System.now().toEpochMilliseconds()
107+
var mark = TimeSource.Monotonic.markNow()
108108
while (true) {
109109
delay(16) // ~60fps
110-
val now = Clock.System.now().toEpochMilliseconds()
111-
val elapsed = now - lastUpdateTime
112-
lastUpdateTime = now
110+
val elapsed = mark.elapsedNow().inWholeMilliseconds
111+
mark = TimeSource.Monotonic.markNow()
113112
displayTimeMs += elapsed
114113
}
115114
}

mediaplayer/src/commonMain/kotlin/io/github/kdroidfilter/composemediaplayer/util/TimeUtils.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package io.github.kdroidfilter.composemediaplayer.util
22

3-
import kotlinx.datetime.Instant
4-
import kotlinx.datetime.TimeZone
5-
import kotlinx.datetime.toLocalDateTime
6-
import kotlin.time.Duration.Companion.seconds
73

84
/**
95
* Formats a given time into either "HH:MM:SS" (if hours > 0) or "MM:SS".

sample/composeApp/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ kotlin {
6969

7070
android {
7171
namespace = "sample.app"
72-
compileSdk = 35
72+
compileSdk = 36
7373

7474
defaultConfig {
7575
minSdk = 21
76-
targetSdk = 35
76+
targetSdk = 36
7777

7878
applicationId = "sample.app.androidApp"
7979
versionCode = 1

sample/iosApp/iosApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
A9D80A052AAB5CDE006C8738 /* ShellScript */ = {
115115
isa = PBXShellScriptBuildPhase;
116116
buildActionMask = 2147483647;
117+
alwaysOutOfDate = 1;
117118
files = (
118119
);
119120
inputFileListPaths = (
@@ -126,7 +127,7 @@
126127
);
127128
runOnlyForDeploymentPostprocessing = 0;
128129
shellPath = /bin/sh;
129-
shellScript = "cd \"$SRCROOT/..\"\n./../gradlew :sample:composeApp:embedAndSignAppleFrameworkForXcode\n";
130+
shellScript = "set -eo pipefail\n# Ensure we run from the iOS project folder's parent (sample)\ncd \"$SRCROOT/..\"\n\n# Prefer JDK 17 (or 21) for Gradle, if available\nif command -v /usr/libexec/java_home >/dev/null 2>&1; then\n export JAVA_HOME=$(/usr/libexec/java_home -v 17 2>/dev/null || /usr/libexec/java_home -v 21 2>/dev/null || true)\nfi\n\n# Run Gradle task to build and embed the Kotlin framework for Xcode\n./../gradlew :sample:composeApp:embedAndSignAppleFrameworkForXcode --no-configuration-cache --stacktrace --info\n";
130131
};
131132
/* End PBXShellScriptBuildPhase section */
132133

sample/iosApp/iosApp/Info.plist

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@
44
<dict>
55
<key>CADisableMinimumFrameDurationOnPhone</key>
66
<true/>
7+
8+
<key>UIApplicationSceneManifest</key>
9+
<dict>
10+
<key>UIApplicationSupportsMultipleScenes</key>
11+
<false/>
12+
<key>UISceneConfigurations</key>
13+
<dict>
14+
<key>UIWindowSceneSessionRoleApplication</key>
15+
<array>
16+
<dict>
17+
<key>UISceneConfigurationName</key>
18+
<string>Default Configuration</string>
19+
<key>UISceneDelegateClassName</key>
20+
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
21+
<key>UISceneClassName</key>
22+
<string>UIWindowScene</string>
23+
</dict>
24+
</array>
25+
</dict>
26+
</dict>
27+
728
<key>NSAppTransportSecurity</key>
829
<dict>
930
<key>NSAllowsArbitraryLoads</key>

0 commit comments

Comments
 (0)