Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem to load asset on demand #16

Open
megajogos opened this issue Jan 9, 2023 · 0 comments
Open

Problem to load asset on demand #16

megajogos opened this issue Jan 9, 2023 · 0 comments

Comments

@megajogos
Copy link

megajogos commented Jan 9, 2023

I'm currently trying to implement Assets delivery on demand in my application, but I'm not getting it to work. It's showing in logcat that the download was completed, but I'm not able to access the file inside the folder. Do you have an example of how to do this process?

Below is the structure I made in the app:
app.xml
<assetPacks> <assetPack id="audioAssetPack" delivery="on-demand" folder="audioAssetPack"/> </assetPacks>

My code:
`assetsOnDemand = new PlayAssetDelivery();
trace("!!!assets.initAssetDelivery() ", assetsOnDemand.initAssetDelivery())
if (assetsOnDemand.initAssetDelivery()){
assetsOnDemand.addEventListener(PlayAssetDeliveryEvent.PLAY_ASSET_UPDATE, playAssetDeliveryStatusHandler);
trace("!!!PlayAssetDelivery initialised");
trace("!!!PlayAssetDelivery initialised2", assetsOnDemand.fetchAssetPack("audioAssetPack"));
trace("!!!PlayAssetDelivery initialised3", assetsOnDemand.getAssetPackStatus("audioAssetPack"));
trace("!!!PlayAssetDelivery initialised6", assetsOnDemand.getAssetPackLocation("audioAssetPack"));
}

private function playAssetDeliveryStatusHandler(event):void {
trace( "asset pack name: " + event.assetPackName );
trace( "status: " + PlayAssetStatus.getStatus(event.status) ); // Value from PlayAssetStatus
trace( "location: " + assetsOnDemand.getAssetPackLocation("audioAssetPack"));
trace( "location2: " + assetsOnDemand.getAssetAbsolutePath("audioAssetPack", "audioAssetPack/sfx_peca_domino.mp3"));
trace( "location3: " + assetsOnDemand.getAssetAbsolutePath("audioAssetPack", "audioAssetPack\sfx_peca_domino.mp3"));
trace( "location4: " + assetsOnDemand.getAssetAbsolutePath("audioAssetPack", "sfx_peca_domino.mp3"));
trace( "location5: " + assetsOnDemand.getAssetAbsolutePath("audioAssetPack", "audioAssetPack"));
trace( "location6: " + assetsOnDemand.getAssetAbsolutePath("sfx_peca_domino.mp3", "audioAssetPack"));
trace( "location7: " + assetsOnDemand.getAssetAbsolutePath("audioAssetPack/sfx_peca_domino.mp3", "audioAssetPack"));
trace( "location8: " + assetsOnDemand.getAssetAbsolutePath("audioAssetPack\sfx_peca_domino.mp3", "audioAssetPack"));
}`

logcat output
2023-01-09 19:31:38.306 6368-6368/air.br.com.megajogos.mobile D/AppLovinAdapter: Requesting banner of size BANNER for zone: 757202f26f06f141 2023-01-09 19:31:38.363 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: asset pack name: audioAssetPack 2023-01-09 19:31:38.363 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: status: COMPLETED 2023-01-09 19:31:38.366 6368-6368/air.br.com.megajogos.mobile E/PlayCore: UID: [10264] PID: [6368] AssetPackStorage : Failed to find assets directory: /data/data/air.br.com.megajogos.mobile/files/assetpacks/audioAssetPack/119003029/119003029/assets 2023-01-09 19:31:38.366 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: location: null 2023-01-09 19:31:38.370 6368-6368/air.br.com.megajogos.mobile E/PlayCore: UID: [10264] PID: [6368] AssetPackStorage : Failed to find assets directory: /data/data/air.br.com.megajogos.mobile/files/assetpacks/audioAssetPack/119003029/119003029/assets 2023-01-09 19:31:38.370 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: location2: null 2023-01-09 19:31:38.373 6368-6368/air.br.com.megajogos.mobile E/PlayCore: UID: [10264] PID: [6368] AssetPackStorage : Failed to find assets directory: /data/data/air.br.com.megajogos.mobile/files/assetpacks/audioAssetPack/119003029/119003029/assets 2023-01-09 19:31:38.374 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: location3: null 2023-01-09 19:31:38.377 6368-6368/air.br.com.megajogos.mobile E/PlayCore: UID: [10264] PID: [6368] AssetPackStorage : Failed to find assets directory: /data/data/air.br.com.megajogos.mobile/files/assetpacks/audioAssetPack/119003029/119003029/assets 2023-01-09 19:31:38.378 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: location4: null 2023-01-09 19:31:38.382 6368-6368/air.br.com.megajogos.mobile E/PlayCore: UID: [10264] PID: [6368] AssetPackStorage : Failed to find assets directory: /data/data/air.br.com.megajogos.mobile/files/assetpacks/audioAssetPack/119003029/119003029/assets 2023-01-09 19:31:38.383 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: location5: null 2023-01-09 19:31:38.385 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: location6: null 2023-01-09 19:31:38.387 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: location7: null 2023-01-09 19:31:38.390 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: location8: null 2023-01-09 19:31:38.417 6368-6368/air.br.com.megajogos.mobile I/air.br.com.megajogos.mobile: asset pack name: audioAssetPack

my project structure
Captura

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant