RTMP works on Android, but doesn't work on iOS!
Hi guys,
I'm really stuck, don't know why recently my app can't play some rtmp streamers, it can only work with some others. Previously there was no issue.
Could you see the below peice of code. This one works fine on PC and Android, but not on iOS.
import flash.events.*;
import flash.media.Video;
import flash.net.*;
var client:MediaClient = new MediaClient();
var connection:NetConnection = new NetConnection();
connection.client = client;
// connection.proxyType = "best";
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.connect("rtmp://66.160.142.198/live");
var stream:NetStream;
var video:Video = new Video(480, 320);
addChild(video);
function netStatusHandler(evt:NetStatusEvent):void
{
switch(evt.info.code)
{
case "NetConnection.Connect.Success":
stream = new NetStream(connection);
stream.client = client;
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
stream.play("vtv11");
video.attachNetStream(stream);
break;
default:
// output evt.info.code on screen
break;
}
}
function securityErrorHandler(evt:SecurityErrorEvent):void
{
// output evt.toString() on screen
}
function asyncErrorHandler(evt:AsyncErrorEvent):void
{
// output evt.toString() on screen
}
-------------------------------------------------------
and here is MediaClient class:
-------------------------------------------------------
package
{
public class MediaClient
{
public function onBWDone(...args):void
{
// ouput args
}
public function onFI(...args):void
{
// ouput args
}
public function onMetaData(...args):void
{
// ouput args
}
public function close(...args):void
{
// ouput args
}
}
}
----------------------------------
I tried to output some debug text, I saw it netconnecton was connected, the server invoked onFI() every about 2 seconds, but there's no video and sound. (tested on iOS 4, both 3G and wifi).
I also tried alot of options of the video, netstream and netconnection classes and tried with OSMF, but can't get it work. (I'm using AIR 3.0 sdk).
Thank you so much!
