NotifyFlashIsReady javascript function

enflicker

New Member
Hello,
I was just wondering how I can tell when my swfobject is "ready". What function can I call?
The problem is that when I create a swfobject, there is no "login" method available right after creation. Is there a method such as window.["NotifyFlashReady"] that will get called by the swfobject when the login method becomes available for use?
This method was supported in v1 of flashphoner, but it seems as if it is not supported in v3

I am using the javascript client files for flashphonerV3

EDIT: I added a method in phone.js called window.["NotifyFlashReady"] and it never gets called.
EDIT2: Also, in FlashphonerLoader.js, textContent attribute doesn't exist in ie9 when trying to get the content from the flashphoner.xml file
example:
Code:
var wsPort = $(xml).find("ws_port");
        if (wsPort.length > 0) {
            this.wsPort = wsPort[0].textContent;
        }
What do you suggest using instead?

thank you
 
Last edited:

Alex

Administrator
Staff member
Javascript variable flashphoner can have two objects:
flashphoner = websocketmanager;
flashphoner = swfobject;

The variable is initialized in FlashphonerLoader.js class
Lines 327(assigned WebSocketManager), 357(assigned Flash object)
When flashphoner variable equals WebSocketManager, the "notifyFlashReady" method will not be invoked.
 

enflicker

New Member
Javascript variable flashphoner can have two objects:
flashphoner = websocketmanager;
flashphoner = swfobject;

The variable is initialized in FlashphonerLoader.js class
Lines 327(assigned WebSocketManager), 357(assigned Flash object)
When flashphoner variable equals WebSocketManager, the "notifyFlashReady" method will not be invoked.
what I am saying is that when my flashphoner variable is equal to the swfobject, the notifyFlashReady isn't ever being called. I am pretty sure I am using the flashphoner_js_api.swf provided by the client-side files on github. I understand the other case.

Maybe .nodeValue instead of .textContent
wsPort[0].nodeValue
so the correct way in getting the textContext in ie9 is as such:
Code:
el.textContent || el.text || ""
where
var el = $(xml).find('element_here')[0]
I made a pull request on your github wcs_video repo which should fix this issue


EDIT: after some more investigation, I found that an older version of the flashphoner_js_api.swf (probably taken from v2) indeed HAS the notifyFlashReady method and it got called when Flash was ready. So the current flashphoner_js_api.swf (provided here https://github.com/flashphoner/flashphoner_client/tree/wcs_video/client/client/src/js ) does NOT support notifyFlashReady. Now when I try to login using the old flashphoner_js_api.swf file I get an error "Error calling method on NPObject." But login works fine using the latest flashphoner_js_api.swf
In summary, old .swf file has notifyFlashReady but login throws an error, latest .swf file DOESN'T have notifyFlashReady but login works.
 
Last edited:

Alex

Administrator
Staff member
The pull request is accepted. Thank you.
Regarding the 'notifyFlashReady' function. This function was used to indicate that flashphoner.xml config was successfully loaded and parsed by Flash.
Currently this function is not used.
Use 'notifyConfigLoaded' instead of.
https://github.com/flashphoner/flashphoner_client/blob/wcs_video/client/client/src/js/Phone.js
Line 276.
Code:
function notifyConfigLoaded() {
    notifyReady();
    flashphoner = flashphonerLoader.getFlashphoner();
    flashphoner_UI = flashphonerLoader.getFlashphonerUI();
    flashphonerListener = flashphonerLoader.getFlashphonerListener();
    messenger = new Messenger(flashphoner);
https://github.com/flashphoner/flas...deo/client/client/src/flashphoner_js_api.mxml
Line 61.
Code:
private function wait():void{               
                if (flashAPI.isInitialized()){
                    Logger.info("FlashAPI has been initialized");
                    flashAPI.initMedia();
                    ExternalInterface.call("notifyConfigLoaded");
                } else{
                    Logger.info("Waiting flashAPI initialization...");
                    setTimeout(wait,500);
                }
            }
 
Top