ERROR Error: Flashphoner API is not initialized

motipa

New Member
When i try to create session using @flashphoner/websdk in angular project, I got ERROR Error: Flashphoner API is not initialized
 
Last edited:

Max

Administrator
Staff member
Good day.
Perhaps you have not calling Flashphoner.init() method on page load, for example (GitHub):
Code:
  methods: {
    onLoad() {
      try {
        Flashphoner.init({});
        this.localVideo = document.getElementById('localVideo');
        this.remoteVideo = document.getElementById('remoteVideo');
      }
      catch(e) {
        ...
      }
    },
    ...
  }
Please refer to Vue integration example: Two Way Streaming Vue
 

motipa

New Member
my code is
private initFlashphoner(): void {
Flashphoner.init({});

this.session = Flashphoner.createSession({
urlServer: '', // Replace with your server URL
});
this.session.on(Flashphoner.constants.SESSION_STATUS.ESTABLISHED, (session: any) => {
this.publishStream(session);
});
}

GOT ERROR MESSAGE FOR ABOVE CODE
 

motipa

New Member
thanks you for your support, issue solved. I got a new issue that
Failed to create audio context
ERROR ReferenceError: adapter is not defined. It would be helpful if find out where i am lacking
 

motipa

New Member
Still i am getting

Failed to create audio context
ERROR ReferenceError: adapter is not defined
 

motipa

New Member
Thanks for the support. but now after published the angular site. Iphone is not supported the video. we are getting blank display.
 

Max

Administrator
Staff member
Thanks for the support. but now after published the angular site. Iphone is not supported the video. we are getting blank display.
Please clarify the following:
1. What WCS and WebSDK versions do you use?
2. What iOS version do you test?
3. What do you try to test in Safari browser: publishing or playback?
4. Is the issue reproducing in pure Javascript Two Way Streaming example (demo server: https://demo.flashphoner.com:8444/c...ng/two_way_streaming/two_way_streaming.html)?
 

motipa

New Member
websdk version
@version Version: 1.0.0-beta
12pro and 15 max pro
safari, chrome. already javascript enabled in iphone. issue reporducing pure javascript implement in angular. I tried with pure javascript bundle too even though not recommended. but using for testing. I am using create session and playstream(), not using publishing methods
 

Max

Administrator
Staff member
We tested WebRTC playback in iOS Safari 17.4.1 (iPhone 12 mini) on our demo server (WCS build 5.2.1917, WebSDK build 2.0.240):
1. Published a test stream in Media Devices example in Windows Chrome 123
1713148859470.png

2. Played the test stream in Player example in iOS Safari 17.4.1
1713148969893.png

The stream is playing successfully. No any frameworks, just pure Javascript. Please perform such test on your server. If a problem is reproducing provide an access to your server using this form.
 

Max

Administrator
Staff member
We checked publishing and playback on your server.
When using a valid server domain name (we get it using reverse DNS lookup), a test stream is playing successfully in Player example in iOS Safari 17.4.1.
But Safari refuses to connect to secure Websocket when connecting by IP address
1713401578069.png

So you should always use a valid domain name with a valid SSL certificate to connect and play stream.
 

Max

Administrator
Staff member
Please clarify:
- What WCS build do you use?
- What player example do you use to play: HLS.JS Player minimal, VideoJS Player minimal?
- Steps to reproduce a problem from publishing a stream to playing it.

There is no autoplay option for HLS playback, you should just get an HLS stream URL and use a player. All the player examples just wrap HLS.JS or VideoJS library respectively:
Code:
function playBtnClick() {
    if (validateForm()) {
        var llHlsEnabled = $('#llHlsEnabled').is(":checked");
        var streamName = $('#playStream').val();
        streamName = encodeURIComponent(streamName);
        var videoSrc = $("#urlServer").val() + '/' + streamName + '/' + streamName + '.m3u8';
        var key = $('#key').val();
        var token = $("#token").val();
        if (key.length > 0 && token.length > 0) {
            videoSrc += "?" + key + "=" + token;
        }
        hlsPlayer = new Hls(getHlsConfig(llHlsEnabled));
        hlsPlayer.on(Hls.Events.MANIFEST_PARSED, function() {
            console.log("Play with HLS.js");
            remoteVideo.play();
        });
        hlsPlayer.loadSource(videoSrc);
        hlsPlayer.attachMedia(remoteVideo);
        onStarted();            
    }
}
 
Top