VideoPlayer in Emulator: 701 error (cannot load mp4)

Hi, is it a known issue that videos will not load in the Emulator? Tried searching and did not see anything about this.

We have small video files that are under the right file size and are a legal format. Even with just a VideoPlayer component added, the Emulator always says, “Error 701: Unable to load [file name].” We have tried the tips from these forums for clock timers, etc., and nothing seems to work. When hooking up a physical device as the companion device, the video plays with no issues.

1 Like

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


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Hi, Taifun, this is the method we are trying in any app we try this in. The blocks are below. It is super simple (basically the same setup as this but without the stop button: https://www.youtube.com/watch?v=wgy1KaISfBQ) and isn’t loading in the Emulator, but is on a device. I wondered if something was missing (pretty new to App Inventor) or if this is a known bug in the Emulator.

The video file was uploaded through the media panel and then selected as the source for VideoPlayerWelcome. The file is 554 KB and is an mp4 so it should be legal. Just added a button to trigger it to play (also tried just clicking the built-in play button as shown in the video) but it continuously gives an error. I have also closed out App Inventor and reopened it thinking maybe it needed to load fresh with the file from the start and that did not work either.

blocks

did you set the source of the video in the designer? if yes, how? any screenshot of the designer settings of the videoplayer? did you upload the videos in the media section of the designer into the assets of the app?
Taifun

Yes, that info was included in the reply above. I will add a screenshot here if that helps.

Try setting the size W x H of the video player, and ensure you are using responsive sizing

Screen1 is set to responsive, not fixed. I have tried this using both pixels (200x200 to make sure it is well within the size of the Emulator’s screen) and % (50% for both) and that did not work. The problem is not that is doesn’t show in the VideoPlayer window, it is that the Emulator won’t load the video file.

Have you tried different videos ? (I see you mentioned them earlier)

Which version of the emulator are you using? The older emulator version likely doesn’t have the codecs to handle MP4. The newer emulator might but I haven’t checked. If you are willing to share the MP4 file with us we can also run a test on it to better understand why it might not be working.

I am using the most recent version available (only started using this about a month ago). Here is a video showing an example of the same steps that were followed if that helps: https://drive.google.com/file/d/1GtQO02oRZ79QqbL46sAdG8uPEpcIjGhQ/view?usp=sharing

I have also tried other videos, including smaller sizes to see if it was a loading time issue, etc. The video in the example above is well under the size limit.

Thanks @Jamie_B, that’s helpful. I’ll see if we can replicate it here and what we might be able to do to fix it if so. If it’s possible would you mind sending me the video privately so I can run some tests?

Thanks so much, @ewpatton! I will send that over shortly. It works when connecting a physical device for live testing, just not in the emulator.

Try this: videoTest.aia (928.4 KB)
Does it work for you (with Companion)?
For me it’s working on a Galaxy Note 8 (Android 9) and S6 (Android 7).
What version of Android are you using?

Note (to @ewpatton):
It is not possible to set the VideoPlayer.Source in the same button with VideoPlayer.Start. It is therefore not possible to change the souce afterwards (block-controlled) in the same block with which you start the video.

You need another button or use a timer:

  1. a) ButtonX: source
    b) ButtonY: start video
    or:
  2. Button: source and enable a timer to start the video.

So it is not possible to do that at the same time (using only one button).

videoTest2.aia (2.3 MB)


or:

Btw, I miss this block:
grafik

@Anke I’ve identified the issue with the source/start issue. Apparently it’s been like this since 2012. @bartmathijssen also has a fix in the queue that will give you the Source getter block.

Can you please refer to a link to that … I didn’t find anything about this …
and what’s about the missing block?

And, even if it is, why isn’t it changed?

Hi, @Anke, thanks so much. It works just fine with the companion app and a device. It is only not loading in the Emulator.

@Anke This first file you sent did work in the Emulator. @ewpatton any ideas on why it doesn’t work in the one I messaged you? The apps are virtually the same.

For anyone else having this issue, @ewpatton and team looked into this and found the issue :slight_smile: The version of Android that comes with the Emulator only supports the baseline h264 codec. The video files we were using were exported using an h264 high profile. This was causing errors with loading in the Emulator only but worked in a live device since that has a newer version of Android that does support high h264 videos. We are re-exporting the videos using the baseline profile instead to make this work.

(added to Videos FAQ)

1 Like