Video Player not playing assets programmatically

I checked out Bugs in Kodular Eagle before creating a new topic

Describe your issue

The Kodular Video Player is not playing assets programmatically.

Steps to reproduce the issue

  1. Add the component
  2. Set source to none initially and controls not visible
  3. Programmatically (blocks) set source to asset_file.mp4
  4. Call the start method - nothing happens
  5. However when I show the controls and manually press Play, video plays well.

Expected Behaviour

Video should play.

Actual Behaviour

Video does not play.

Android version

Version 10

Use clock or web component in clock

  1. Clock: Set 1-2 sec time and then after set video source then enable clock time and after clock time do then off time and set video player play video.

  2. Web: Use web component and set url to https://www.google.com/ and after set video source then call to web get block after that use when got text block then set video player to play video.

1 Like

Thanks a lot @WeMakeBest

I used the clock component (instruction 1), set it to 2 seconds and everything worked like a charm.

Really appreciate your help in this.

Posting an update on this:

The solution above works in the Companion.

When you build the apk, you get an Error 701 (file not found).

There is already another thread about this if you search in the community forum and it seems to be a bug with the VideoPlayer component. There are workarounds but I prefer a working component.

Can someone suggest a good (and possibly free) video player extension for Kodular until the bug is fixed please?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun

This bug still doesn’t seem to have been fixed since 2019.

Thanks for all your replies.

@Taifun - the 701 error disappears when I load the file from the device using file:///sdcard/…

@bodymindpower - Yes in fact it seems that the bug is still not solved unfortunately

My suspicion is that the Video Player is always trying to find the source either from the internal storage of the device or else from the Application Specific Directory.

To test this, I would appreciate your help (maybe even posting a screenshot with the blocks). I would like to make my application such that on Screen1.Initialize:

  1. Checks if my video assets exist in the ASD
  2. If not, the app copies them to the ASD

I will then test by trying to play the video using just the name. If this works, then my theory is right.

I guess it can be done using a combination of @Taifun file extension (https://puravidaapps.com/file.php) and the extension by @bodymindpower that I found here: https://community.appinventor.mit.edu/t/get-the-path-of-the-asd-app-specific-directory/17004 - However I do not know whether it works in kodular as well.

Thanks in advance for your time.

1 Like

yes, of course… what about trying something yourself?
all the methods you need you can find in the file extension
https://puravidaapps.com/file.php
and if you get stuck, then post a screenshot of your relevant blocks…
Taifun

@Taifun using your extension I successfully managed to copy my files to the ASD. However the Video Player still does not search for the files there, when using just the name (ex: video1.mp4). Therefore, my suspicions were wrong.

I have decided to create a folder and store all the videos there temporarily. However I have a list of videos which I intend to copy asynchronously. I do not know how to handle the AfterFileListAsync event correctly though. I know how to store files in a list but how can I copy them one by one and detect when the last file in the list has finished copying please?

Here is a test APK that can be used to test different paths of the Video_Player.
As I have said often enough, it is still not possible to play a video from the assets. But other paths (especially from the ASD) do not work either.
videoPlayerPath.apk (5.9 MB)

Can you please check this. @pavi2410 @Vishwas
These bugs should finally be fixed.
I reported this bug for the first time in July 2019.

Test on a Galaxy Note8 (Android 9):

(Note: on a Pixel 2XL, Android 11, no path to ASD works)

1 Like

We’ll take a look again, thanks for reminding us of the issue

2 Likes

do it asynchronously… i.e. Copy the first file and in the Copied event check if there is another file to copy and if yes copy it, etc.
see also this example App Inventor Tutorials and Examples: Webprefetch File by File | Pura Vida Apps which is about something completely different, but the logic to use is the same

Taifun

Thanks @Taifun for providing the link. It helped me a lot and I managed to achieve what I wanted.

Thanks @bodymindpower for reminding Kodular staff of the issue and for providing the videoPlayerPath.apk - Things are much clearer to me at this point. I hope that this VideoPlayer bug is solved soon…

Yes, and this issue (topic) has not yet been resolved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.