Expand my Community achievements bar.

Getting user displayName from a stream

Avatar

Level 4

i\m extending WebcamSubscriber and overriding layoutCameraStreams to create my own visual layout, great, but part of the procedure has got me foxed. i need the stream's user's displayName to show in the cameraUserBar.cameraUserLabel. hows' this done? i've got this, the questin is what should i put where the ???'s are?


override protected function layoutCameraStreams ():void
{
    for (var id:String in _streamDescriptorTable){
        if (_cameraUserBarObj[id] != null){
            var cameraUserBar:CameraUserBar = _cameraUserBarObj[id] as CameraUserBar;

            cameraUserBar.cameraUserLabel = ???
        }
    }
}

2 Replies

Avatar

Level 4

ok so i found the answer myself by looking in WebcamSubscriber

override protected function layoutCameraStreams ():void
{
    for (var id:String in _streamDescriptorTable){
        if (_cameraUserBarObj[id] != null){
            var cameraUserBar:CameraUserBar = _cameraUserBarObj[id] as CameraUserBar;

           var d:StreamDescriptor = _streamDescriptorTable[id];
             if (d) {
                 var publisherID:String = d.streamPublisherID;
                 var ud:UserDescriptor = userManager.getUserDescriptor(publisherID);
                 cameraUserBar.cameraUserLabel = ud.displayName;

            }

        }
    }
}

i have to say, getting this object to get that object to get a third object is a very much round-the-houses and not intuitive. this has to be read, or told, it cannot easily be figured out. imo what would be preferable would be something like:

override protected function layoutCameraStreams ():void
{
    for (var id:String in _streamDescriptorTable){
        if (_cameraUserBarObj[id] != null){
            var cameraUserBar:CameraUserBar = _cameraUserBarObj[id] as CameraUserBar;

            var ud:UserDescriptor = userManager.getUserDescriptor(id, StreamManager.STREAM_DESCRIPTOR_ID);
            cameraUserBar.cameraUserLabel = ud.displayName;

        }
    }
}

also, whats with the single letter var names?! makes it really unreadable. we don't want:

var d:StreamDescriptor = _streamDescriptorTable[id];

we want:

var streamDescriptor:StreamDescriptor = _streamDescriptorTable[id];

afcs is still a great product tho guys, keep up the good work, just throwing some ideas out.

Avatar

Former Community Member

Hi,

Thanks for your feedbacks. We always look forward to them. I agree we have some variable naming lying here and there that is not conistent. And we look forward to your help in imporving the SDK.

Thanks

Hironmay Basu