Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Dynamic Video adding

$
0
0
Hello All,

I'm trying to add/remove Video objects to scrolling view dinamically in
Mobile project.
Here is the base markup

........... skipped .............
<s:Scroller id="vGroupScroller" width="250">
<s:HGroup id="videoGroup" height="{SMALL_HEIGHT + 10}" gap="5"
paddingTop="5" paddingLeft="5" paddingRight="5"
paddingBottom="5"></s:HGroup>
</s:Scroller>
........... skipped .............

and code:
for (var i:int = 0; i < result.length; ++i) {
if (broadcastId == result[i].broadCastId) {
continue; //self

var ui:UIComponent = new UIComponent();
ui.width = SMALL_WIDTH;
ui.height = SMALL_HEIGHT;
videoGroup.addElement(ui);

var vid:Video = new Video();
vid.width = SMALL_WIDTH;
vid.height = SMALL_HEIGHT;
ui.addChild(vid);

var rc:RoomClient = new RoomClient();
trace("Creating NetStream, bcId: " + result[i].broadCastId);
var ns:NetStream = new NetStream(app.nc);

ns.addEventListener(NetStatusEvent.NET_STATUS, function
(e:NetStatusEvent):void {
trace("ns::netstatus " + e.info.code);
});
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, function
(e:AsyncErrorEvent):void {
trace("ns::async " + e);
});
ns.client = {
onMetaData: function (item:Object):void {
trace("onMetaData: " + item);
}/*,
onPlayStatus: function (status:Object):void {
trace("onPlayStatus: " + status);
},
onCuePoint: function (item:Object):void {
trace("onCuePoint: " + item);
},
ioError: function (item:Object):void {
trace("ioError: " + item);
},
netStatus: function (item:Object):void {
trace("netStatus: " + item);
},
asyncError: function (item:Object):void {
trace("asyncError: " + item);
}*/
};
rc.broadCastId = result[i].broadCastId;
rc.streamId = result[i].streamId;
//rc.ns = ns;

// TODO save use first/last name etc.
clients.addItem(rc);

vid.attachNetStream(ns);
ns.play(result[i].broadCastId, -1);

result I'm iterating in the loop is the list of objects containing
broadcastId

I'm using Apache-flex-4.13.0, IntellyJ Idea 13
Application is running on Samsung Galaxy 3 USB debug
Red5 is used as server

As the result I'm getting is extremely weird:
In case there is only one video: I get "black box" instead of video stream
Then device switch off and lock the screen;
After unlocking the whole screen is black (all other controls are covered
with black rectangle) but video is live
Another lock/unlock: controls are visible, video == black box

In case screen is turned off (but not locked) I have live video

In case of 2 video windows: firstone is displayed as expected, second one
is black, lock/unlock same blackbox

I have no trace events from ns.client
If more methods of ns.client are uncommented I get no video at all

Will appreciate any help

Thanks in advance

Viewing all articles
Browse latest Browse all 5648

Trending Articles