Problems with local video playback on Samsung Galaxy S2 ?
Hi!
I have been trying for a while to get local video play in my app on a Samsung Galaxy 2. (Everything works fine running on desktop with different devices, only when I run on device I get problems.)
Have no problems to do that, but the result is tearing (bad).
Im using examples from different sources, where people seems to have no problems at all. Have tried mp4 and flvs, even videos gotten from
http://www.broken-links.com/tests/video/.
The videos play fine in the Samsung videoplayer.
Now I saw the pink tinted problem further down and start to wonder if my problem could be related?
Anyone have a code example that works on Samsung Galaxy S2?
I also tried to change the <renderMode>cpu</renderMode>
from auto.
Also did some tried to get StageWebView to work, but couldn't get the html5 videotag to work.
Any suggestions?
Best Regards
Lukas
Here is what I tried ( taken from the book "Developing Android Applications with Adobe" AIR by Véronique Brossier)
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.NetStatusEvent;
import flash.filesystem.File;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
public class MTest extends Sprite
{
private var _connection:NetConnection;
private var _video:Video;
public function MTest()
{
super();
// support autoOrients
// stage.align = StageAlign.TOP_LEFT;
// stage.scaleMode = StageScaleMode.NO_SCALE;
init();
}
private function init():void
{
_video = new Video();
// change these dimensions based on the resolution of your video
_video.width = 640;
_video.height = 360;
//_video.width = 480;
//_video.height = 320;
//_video.width = 480;
//_video.height = 270;
_connection = new NetConnection();
_connection.addEventListener(NetStatusEvent.NET_STATUS, netConnectionEvent);
_connection.connect(null);
}
private function netConnectionEvent(event:NetStatusEvent):void
{
event.target.removeEventListener(NetStatusEvent.NET_STATUS, netConnectionEvent);
if (event.info.code == "NetConnection.Connect.Success")
{
var stream:NetStream = new NetStream(_connection);
var client:Object = new Object();
client.onMetaData = onMetaData;
stream.client = client;
//var videoName:String = "BigBuck-1.m4v";
/// var videoName:String = "BBB_480_VLC.mp4";
var videoName:String = "dragon.flv";
_video.attachNetStream(stream);
stream.play( videoName);
addChild(_video);
}
}
private function onMetaData(info:Object):void
{
}
}
}
and the flex try:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:assets="skins.assets.*"
xmlns:skins="skins.*"
xmlns:MyComp="MyComp.*"
title="{resourceManager.getString('LocalizedStrings', 'VideoTest1')}"
>
<fx:Script>
<![CDATA[
import mx.events.ResizeEvent;
public function refresh(): void
{
myVid.source = "/assets/fight1-1.m4v";
}
protected function videoView_resizeHandler(event:ResizeEvent):void
{
myVid.height = this.height;
myVid.width = this.width;
}
]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<s:VideoDisplay id="myVid"
source="/assets/fight1-1.m4v"
/>
<s:Button click="myVid.pause();navigator.pushView(Page5)" label="{resourceManager.getString('LocalizedStrings', 'next')}"/>
</s:View>
