Emulator: Trying to erase a non-existent color buffer with handle 0

I’ve got an app that is running fine on iOS and the simulator, but when I try to run it on Android I get the following error:

Emulator: Trying to erase a non-existent color buffer with handle 0

The error occurs after playing a video. I was wondering if anyone else had had an issue like this before and what can be done to track the issue down as it’s a bit vague.

One of the big differences between the Android and iOS versions are that the videos are transferred to the app using iTunes File Sharing while on Android they are downloaded from AWS.

In both cases the videos are run using the command:

local onComplete = function(event)           practiceslot.markPractice()           daycounter.markStarted()           logging.addData("circles shown",config.cirlces)           composer.gotoScene("scenes.multiplechoice",{params={               .... end media.playVideo(config.file,system.DocumentsDirectory,false,onComplete)

The first three lines in the on complete listener are writing json files to the DocumentDirectory and the multiplechoice scene has already been shown a few times before the video plays.

The app runs fine until the video completes, at which point it closes on the device without warning. In the simulator I got the above error. Any thoughts?

I have reduced the problem down to the following (which runs if a JSON videos is found and the videos are on the device)

&nbsp; local prob=math.random() &nbsp; local config &nbsp; local i=1 &nbsp; local files=jsonreader.load(system.pathForFile("videos.json",system.DocumentsDirectory)) &nbsp; repeat &nbsp; &nbsp; config=files[i] &nbsp; &nbsp; i=i+1 &nbsp; &nbsp; prob=prob-config.probability &nbsp; until prob\<=0 &nbsp; media.playVideo(config.file,system.DocumentsDirectory,false,function() &nbsp; &nbsp; composer.gotoScene("scenes.start") &nbsp; end)

I think it must be an issue with media.playVideo. As said the video runs fine, but the app closes instantly on the device without error.

Running the APK in Android Studio I see the error:

 Emulator: Trying to erase a non-existent color buffer with handle 0

The videos I am generating are created using moviepy which is calling into FFMPEG with the following parameters:

codec="libx264", audio\_codec='aac', temp\_audiofile='temp-audio.m4a',remove\_temp=True, preset="medium", ffmpeg\_params=["-profile:v", "baseline", "-level", "3.0", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "-pix\_fmt", "yuv420p"])

I don’t know if any of those parameters jump out as being problematic. I also remove the audio from the clip when I use it (we want to force it to be mute). 

Okay, I’ve reduced my code down to the following:

&nbsp; media.playVideo("wash\_1\_circles.mp4",system.ResourceDirectory,false,function() &nbsp; &nbsp; display.newText("It did not crash", display.contentCenterX, display.contentCenterY) &nbsp; end)

It runs fine in the simulator, but closes without any error message in the Android Emulator. 

Ah, I did a bit more digging: there’s a segault happening. Have file a bug report.

I have reduced the problem down to the following (which runs if a JSON videos is found and the videos are on the device)

&nbsp; local prob=math.random() &nbsp; local config &nbsp; local i=1 &nbsp; local files=jsonreader.load(system.pathForFile("videos.json",system.DocumentsDirectory)) &nbsp; repeat &nbsp; &nbsp; config=files[i] &nbsp; &nbsp; i=i+1 &nbsp; &nbsp; prob=prob-config.probability &nbsp; until prob\<=0 &nbsp; media.playVideo(config.file,system.DocumentsDirectory,false,function() &nbsp; &nbsp; composer.gotoScene("scenes.start") &nbsp; end)

I think it must be an issue with media.playVideo. As said the video runs fine, but the app closes instantly on the device without error.

Running the APK in Android Studio I see the error:

 Emulator: Trying to erase a non-existent color buffer with handle 0

The videos I am generating are created using moviepy which is calling into FFMPEG with the following parameters:

codec="libx264", audio\_codec='aac', temp\_audiofile='temp-audio.m4a',remove\_temp=True, preset="medium", ffmpeg\_params=["-profile:v", "baseline", "-level", "3.0", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "-pix\_fmt", "yuv420p"])

I don’t know if any of those parameters jump out as being problematic. I also remove the audio from the clip when I use it (we want to force it to be mute). 

Okay, I’ve reduced my code down to the following:

&nbsp; media.playVideo("wash\_1\_circles.mp4",system.ResourceDirectory,false,function() &nbsp; &nbsp; display.newText("It did not crash", display.contentCenterX, display.contentCenterY) &nbsp; end)

It runs fine in the simulator, but closes without any error message in the Android Emulator. 

Ah, I did a bit more digging: there’s a segault happening. Have file a bug report.