feathersui / feathersui-starling

User interface components for Starling Framework and Adobe AIR
https://feathersui.com/learn/as3-starling/
Other
915 stars 386 forks source link

VidePlayer texture error #1733

Closed ventr1x closed 6 years ago

ventr1x commented 6 years ago

In reference to this thread: https://forum.starling-framework.org/topic/videoplayer-issues-on-android

Basically my last post explains the issue.

Environment:

Starling 2.3 Feathers 3.4.0 AIR26 to AIR 29 Android only (ios seems to work)

First, the AIR runtime always throws this error onto the device log:

java.lang.NoSuchMethodError: no non-static method "Lcom/adobe/flashruntime/air/VideoTextureSurface;.getHeight()

Futhermore I get random errors on video playback:

The errors are completely random and not directly reproducable. It does work 50% of the time.

As I assumed there to be a timing issue where the texture/player is not ready, even though I receive the ready event I added a little delay which currently completely resolves my issues:

setTimeout(function():void {
    _loader.source = _player.texture;
}, 100);

Full (relevant) example I'm using:

public function playVideo(name:String):void {
    videoFile = File.applicationDirectory.resolvePath(name);

    _player = new VideoPlayer();
    _player.setSize( app.config.stageWidth, app.config.stageHeight);
    _player.addEventListener(Event.READY, videoPlayer_readyHandler);
    _player.addEventListener(Event.COMPLETE, videoPlayer_completeHandler);
    playerSprite.addChild(_player);

    _loader = new ImageLoader();
    _loader.width = app.config.stageWidth;
    _loader.height = app.config.stageHeight;
    _player.addChild(_loader);

    _player.videoSource = videoFile.url;
}
private function videoPlayer_readyHandler( event:Event ):void {
    this.stage.starling.skipUnchangedFrames = false;

    setTimeout(function():void {
        _loader.source = _player.texture;
    }, 100);
}

I also had to set skipUnchangedFrames = false while playing or the video would freeze on the first frame. Not sure if this is considered a bug (it is for me, but I understand that state changes can be hard to track for video playback).

As this is very hacky and I'd rather not put this state out to production: is there any possible feedback or fix for this?

joshtynjala commented 6 years ago

I'm going to close this to avoid duplicate discussions happening here and in the forum thread. It's definitely an AIR bug, so there's nothing I can do in Feathers anyway.