gpt4 book ai didi

android - 如何在带有 adobe air mobile 的 android 平板电脑上播放视频而不出现断断续续的情况?

转载 作者:太空宇宙 更新时间:2023-11-03 10:53:49 25 4
gpt4 key购买 nike

我正在尝试构建一个可以在 Android 平板电脑上播放视频的应用。这款平板电脑是运行 Android 4.0.3 版的 Transformer Prime。我在 Flex 4.6.0 中使用 flash Builder 4.6。每次我向平板电脑添加视频时,它都非常不稳定和跳跃。如果我尝试使用任何不是 flv 的视频,那么该视频将始终发送到所有其他内容后面的背景,并且不再停留在它所在的容器中。我创建了一个可以向左或向右移动的滑动容器,视频也随之移动,它适用于 flv 文件,但不适用于任何其他文件格式(例如 H.264 和 f4v),它停留在 x = 0 和 y 阶段= 0 不是组 x = 0 和 y = 0 并且不移动。每当播放视频时,总会有屏幕闪烁,然后播放视频。 Flv 文件总是最不适合播放。对不起,我不是在胡说八道,我只是想获取导入的信息
这是我创建的视频播放组的代码。

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" width="960" height="533" xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import mx.events.EffectEvent;
[Bindable] public var imgSource:String = new String();
[Bindable] public var isThereAVideo:Boolean = new Boolean()
public var movieSource:String = new String();
[Bindable] protected var bytes:uint = new uint();
[Bindable] protected var bytesTotel:uint = new uint();

protected function playMovieClick(event:MouseEvent):void
{
// TODO Auto-generated method stub
trace ("you clicked")
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
ns.client={ onMetaData:function(obj:Object):void{} }
ns.play(movieSource);
var myVideo:Video = new Video();
myVideo.width = 960;
myVideo.height = 533;
myVideo.attachNetStream(ns);
uic.addChild(myVideo);
ns.addEventListener(NetStatusEvent.NET_STATUS, netstatusHandler);
quickfade.target = uic;
quickfade.alphaFrom = 0;
quickfade.alphaTo = 1;
quickfade.play();
ns.soundTransform.volume = 0;


}


public function netstatusHandler(evt:NetStatusEvent):void {
if (evt.info.code == "NetStream.Play.Stop") {
quickfade.target = uic;
quickfade.alphaTo = 0;
quickfade.alphaFrom = 1;
quickfade.play();
quickfade.addEventListener(EffectEvent.EFFECT_END, fadeEffectEnd);
}
}

private function fadeEffectEnd(event:EffectEvent):void {
trace("effect ending");
uic.visible = false;
trace("....effect ending");
quickfade.removeEventListener(EffectEvent.EFFECT_END, fadeEffectEnd);
}

public function asyncErrorHandler(event:AsyncErrorEvent):void {
trace(event.text);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:Fade id="quickfade" duration="1500" />
</fx:Declarations>
<s:Image width="100%" height="100%" source="{imgSource}"/>
<s:Image width="75" height="75" bottom="5" right="5" source="img/videoIcon.png" click="playMovieClick(event)" visible="{isThereAVideo}" />
<mx:UIComponent x="0" y="0" id="uic" width="960" height="533" alpha="0" />
<s:Label x="10" y="508" text="v0.1"/>

所以这是我的问题
有没有更好的方法来播放这个视频,让它更流畅?我听说过 stage.stagevideo 但如果我跟踪 stage.stagevideo.length 我总是得到 0?
为什么视频会丢失容器。它与使用舞台宽度设置容器位置有什么关系吗?
有没有办法缓冲视频?

最佳答案

播放视频的最佳方式是使用原生播放器而不是 flex 视频播放器。您仍然需要在 flex 中播放,然后您可以尝试 Stage Video (http://www.adobe.com/devnet/flashplayer/articles/stage_video.html),因为移动设备上的 flex 确实会跳过视频的帧。

关于android - 如何在带有 adobe air mobile 的 android 平板电脑上播放视频而不出现断断续续的情况?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9024618/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com