Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

Starling won't play video on Google Chrome (Desktop) #1020

Closed AlexUrrutia closed 5 years ago

AlexUrrutia commented 6 years ago

Target: Flash player on Desktop Browsers: it works on Safari, Firefox, but it does not work on Google Chrome, it plays audio only

var player:VideoPlayer = new VideoPlayer(); player.setSize(320, 300); player.videoSource = "bunny.mp4"; this.addChild(player); var loader:ImageLoader = new ImageLoader(); player.addChild(loader);

chrome safari

PrimaryFeather commented 6 years ago

We probably need to report this to Adobe or Google. Could you upload the video (or any video) that produces the error?

AlexUrrutia commented 6 years ago

it happens with any video mp4 or live video via rtmp, and Texture.FromNetStream as well

the video file: https://s3.amazonaws.com/flaxbinpic/bunny.mp4

PrimaryFeather commented 6 years ago

I tested this on both MacOS and Windows and can confirm your findings. For easier testing, I created a sample webpage that attempts to play back a video, to be found here. The source code is on GitHub.

I'll forward this information to Adobe!

AlexUrrutia commented 6 years ago

Thank you, Let's hope they fix this ASAP

I get: onRenderState: accelerated on Safari and plays video on Chrome I get onRenderState: software and no video is shown

PrimaryFeather commented 6 years ago

Okay, I've received some information from Adobe about this issue. It seems that the alpha value in the video is zero in this Chrome version — for whatever reason. I'll try to get them to restore the old behavior, of course.

In the meantime, here's a workaround for you. First, enable premultipliedAlpha in the ConcreteVideoTexture constructor by changing this line:

public function ConcreteVideoTexture(base:VideoTexture, scale:Number=1)
{
    super(base, Context3DTextureFormat.BGRA, base.videoWidth, base.videoHeight, false,
          true, false, scale); // <-- first argument changed to 'true'
}

Then you need to change the BlendMode of the image that's displaying the video, like this:

image.blendMode = starling.display.BlendMode.NONE;

That should fix the issue on Chrome, and will have no negative side effects in other browsers.

Again, this is just a workaround — I hope this helps for now. Cheers!

AlexUrrutia commented 6 years ago

@PrimaryFeather Thanks for the update, it seems to be working with this workaround, I can't understand why they set video alpha to zero, very strange

PrimaryFeather commented 5 years ago

I just received word from Adobe that this problem is now fixed! When I run the demo video in the latest Chrome (which run with Flash version 31.0.0.122 for me), the video plays just fine.

Thus, I'll close this issue for now. If you could confirm the fix on your side, too, it would be appreciated, though. :smile: