Comments (8)
If someone is looking for some workarounds for the MediaPlayer issue, the issue created by @Woren has some possible solutions, and I shared one additional workaround there too.
from compose-multiplatform.
It is the expected behavior, because the resource on the android side is located inside a jar archive. The Uri has the correct path but your player doesn't support files in jar archives.
You need to implement a data reading from jars.
from compose-multiplatform.
You could try something like: https://stackoverflow.com/questions/15055747/play-media-from-from-zip-file-without-unzipping
(I haven't check it.)
from compose-multiplatform.
I see in the code logic that for fonts we additionally check if file inside "assets"
is it possible to add option to store files on Android in assets folder? it will fix the issue
otherwise it make sharing files logic useless 🙁
from compose-multiplatform.
@egorikftp First of all, the font check is dirty hack I'd like to remove but it is impossible to create a font by a byte array on android.
sharing files
Files are not resources. Compose resources are part of UI.
There is no such thing as "assets" on the JVM platform. What you ask is a platform dependent solution. If you want to add file to android assets you may use the android assets folder.
from compose-multiplatform.
For anyone interested I've created issue in Media3/Exoplayer repository. I have almost same use case. More details there.
from compose-multiplatform.
is it possible to add option to store files on Android in assets folder?
BTW, there is a technical limitation for that: to read android assets users have to provide an android context. it will make the library API more complicated
from compose-multiplatform.
BTW, there is a technical limitation for that: to read android assets users have to provide an android context. it will make the library API more complicated
@terrakok I think there is still a valid use case for offering support for assets on the resources library, in addition to the reasons above (which are caused by the fact that usage of Jar resources is not common on Android), there have been some issues with the performance of Jar resources in Android (Per my testing, the performance of Jar resources has improved in recent Android versions, but they are still slower by 15% than assets or raw files).
To solve this issue without impacting the API, I think there are some approaches:
- Require passing
Context
for base functions, but make the common functionsComposables
, and make use ofLocalContext.current
in the Android implementations. - Introduce a notion of
PlatformContext
in the library, and require the client apps to pass it in the APIs
What do you think about these ideas?
from compose-multiplatform.
Related Issues (20)
- ImageViewer/Desktop - Build error due to a code not updated after some refactoring
- Enahancement: Background Image Modifier with Alignment and Repeat Options HOT 1
- How to complete the check for updates and automatic updates HOT 2
- The release package failed on Android HOT 2
- Overriding string resources causes crashes or inelligible strings HOT 1
- Plural string not working properly HOT 3
- Is there any consideration for supporting the HarmonyOS? Or adding some public interfaces to adapt to other systems? HOT 1
- LazyVerticalStaggeredGrid rearranges items when scrolling up
- [iOS] voice dictation text does not register with text fields using TextFieldValue HOT 1
- [Compose Web]: TypeError: content is not a function HOT 2
- Support for "Plus Darker" and "Plus Lighter" blend modes HOT 1
- Update Lifecycle Runtime Compose to 2.8.2 HOT 3
- Need some help with debugging the compose multiplatform core code
- IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
- Exception in thread "main" java.lang.NoSuchMethodError: 'void androidx.compose.ui.graphics.SkiaBackedCanvas_skikoKt.setAlphaMultiplier(androidx.compose.ui.graphics.Canvas, float)'
- Multi language string resources can't be decoded in 1.7.0 HOT 2
- need help with compiling CM-core code
- Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot read field "x" because "rc" is null
- How to get performance data between Kotlin Multiplatform Mobile on iOS and Native iOS Development in Swift? HOT 1
- 1.7.0-dev1703 android release build failed when r8 is on
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose-multiplatform.