Closed nidiy closed 5 years ago
VideoTexture in the use of normal away3d
package away3d.textures
{
import away3d.materials.utils.IVideoPlayer;
import away3d.materials.utils.SimpleVideoPlayer;
import away3d.textures.Texture2DBase;
import flash.display3D.Context3D;
import flash.display3D.textures.TextureBase;
import flash.display3D.textures.VideoTexture;
import flash.events.Event;
import flash.events.VideoTextureEvent;
import flash.media.VideoStatus;
public class NativeVideoTexture extends Texture2DBase
{
private var texture:flash.display3D.textures.VideoTexture;
private var _autoPlay:Boolean;
private var _player:IVideoPlayer;
public function NativeVideoTexture(source:String, loop:Boolean = true, autoPlay:Boolean = false, player:IVideoPlayer = null)
{
try
{
_player = player || new SimpleVideoPlayer();
_player.loop = loop;
if (source != "")
{
_player.source = source;
}
_autoPlay = autoPlay;
}
catch (e:Error)
{
trace(e, e.getStackTrace());
}
}
override protected function uploadContent(texture:TextureBase):void
{
}
override protected function createTexture(context:Context3D):TextureBase
{
try
{
if (!Context3D.supportsVideoTexture)
{
throw new Error("flash.display3D.textures.VideoTexture not supported");
return null;
}
texture = context.createVideoTexture();
texture.attachNetStream(_player.ns);
texture.addEventListener(Event.TEXTURE_READY, onTextureReady);
texture.addEventListener(VideoTextureEvent.RENDER_STATE, onRenderState);
if (_autoPlay) _player.play();
}
catch (e:Error)
{
trace(e, e.getStackTrace());
}
return texture;
}
private function onTextureReady(e:Event):void
{
this.dispatchEvent(e.clone())
}
private function onRenderState(e:VideoTextureEvent):void
{
if (e.status == VideoStatus.SOFTWARE)
{
trace("Indicates software video decoding works.")
}
if (e.status == VideoStatus.ACCELERATED)
{
trace("Indicates hardware-accelerated (GPU) video decoding works.")
}
if (e.status == VideoStatus.UNAVAILABLE)
{
trace("Indicates Video decoder is not available.")
}
}
override public function dispose():void
{
if (_player) _player.dispose()
if (texture) texture.dispose()
super.dispose();
}
public function get player():IVideoPlayer
{
return _player;
}
}
}
With the second post, are you suggesting the same video works with Away3D on mobile?
Android devices? AIR SDK videoTexture Fixed Bug,I have tried all versions, a more stable recommendation please air23.221。 Can also try : function onTextureComplete():void{ videoImage = new Image(videoTexture) this.addChild(videoImage) }
@RayGyoe alright, thanks
I have a same issue, with rtmp vp6 video codec and speex sound codec. This is a live chat, which is worked on desktop (video/audio) but not on mobile (novideo/audio) I miss something, or this is not possible on mobile device?
There's unfortunately not much information provided by Adobe about the supported video codecs — at least none that I'm aware of! I brought this topic up once when I talked to them, and was told that on mobile, the codec they recommend is h.264 with AAC audio encoding. That must work — everything else, I don't have confirmation.
However, maybe you can ask that question in the Adobe AIR Community forum!
as I know Adobe has been fixed this bug in AIR 24
Can you link the note of this part of the AIR24 beta release? I really want to use stage3d video instead of native flash display list video. This is works with rtmp live stream, or just with stream from local/remote url?
@varadig There are a few video-related fixes mentioned in the AIR 24 release notes (look for the changes around Oct 28, 2016). Is that what you meant, @22Round?
@hbinnet is your original question / the reason for opening up this issue now solved?
@PrimaryFeather yes, I read in release not and someone wrote that it fixed, but I haven't tested it yet. unconfirmed info!
I have tis issue also on air 24 on iOS.
Can confirm this issue still presents on air 30(!) on mobile.
call videoImage.setRequiresRedraw() on enter frame solves this problem :)
This bug is still on AIR 32, @nidiy can you tell me how did you solve it? I can't play live rtmp VP6 videos using Texture, thanks!
I tried setRequiresRedraw()
as @Gratsonia suggested, but no luck, only audio plays
In the use of Texture.fromNetStream mobile side to play video, only sound no image, the PC-side play normally. If you use flash.media.Video in the mobile side is also normal