WOWZA player not working android app

I made a basic wowza player using the instructions given here :

https://www.wowza.com/docs/how-to-play-a-live-stream-with-wowza-gocoder-sdk-for-android

Note : the streaming part is working and is visible on the wowza streaming cloud website.

The connection settings are done as shown here :

https://www.wowza.com/docs/how-to-connect-to-wowza-streaming-cloud-with-gocoder-sdk-for-android

I am using wowza cloud streaming as the server however I get the following error :

FATAL EXCEPTION: main
Process: trial.drone.streamer, PID: 8450
java.lang.RuntimeException: Unable to start activity ComponentInfo{trial.drone.streamer/trial.drone.streamer.Player}: java.lang.RuntimeException: Invalid surface: null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2455)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2515)
at android.app.ActivityThread.access$1000(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5571)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
Caused by: java.lang.RuntimeException: Invalid surface: null
at com.wowza.gocoder.sdk.api.gles.EglCore.createWindowSurface(GoCoderSDK:225)
at com.wowza.gocoder.sdk.api.gles.EglSurfaceBase.createWindowSurface(GoCoderSDK:58)
at com.wowza.gocoder.sdk.api.gles.WindowSurface.(GoCoderSDK:39)
at com.wowza.gocoder.sdk.api.player.WOWZPlayerView.clear(GoCoderSDK:545)
at com.wowza.gocoder.sdk.api.player.WOWZPlayerView.a(GoCoderSDK:826)
at com.wowza.gocoder.sdk.api.player.WOWZPlayerView.play(GoCoderSDK:900)
at trial.drone.streamer.Player.onCreate(Player.java:41)
at android.app.Activity.performCreate(Activity.java:6357)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2408)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2515)
at android.app.ActivityThread.access$1000(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5571)

This is the code I am using :

    private WOWZPlayerView mStreamPlayerView;
    private WOWZPlayerConfig mStreamPlayerConfig; <br>   private WowzaGoCoder goCoder;@Override<br>protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>setContentView(R.layout.activity_player);<br>goCoder = WowzaGoCoder.init(getApplicationContext(), "license_key");<br>mStreamPlayerView = (WOWZPlayerView) findViewById(R.id.vwStreamPlayer);<br>mStreamPlayerConfig = new WOWZPlayerConfig();<br>mStreamPlayerConfig.setIsPlayback(true);<br>mStreamPlayerConfig.setHostAddress("host_address");<br>mStreamPlayerConfig.setApplicationName("app-xxxx");<br>mStreamPlayerConfig.setStreamName("stream_name");<br>mStreamPlayerConfig.setPortNumber(1935);<br>mStreamPlayerConfig.setAudioEnabled(true);<br>mStreamPlayerConfig.setVideoEnabled(true);<br>mStreamPlayerView.setScaleMode(WOWZMediaConfig.FILL_VIEW);<br>WOWZStatusCallback statusCallback = new StatusCallback();<br>mStreamPlayerView.play(mStreamPlayerConfig, statusCallback);}<br><br>    class StatusCallback implements WOWZStatusCallback{<br>        @Override<br>public void onWZStatus(WOWZStatus wzStatus) {<br>        }<br>        @Override<br>public void onWZError(WOWZStatus wzStatus) {<br>        }<br>    }

Same here. Have you found any solution?

Hi,

I have found some solution for the problem as follows.

Step 1: First initialise the GoCoder inside onCreate().

WowzaGoCoder goCoder = WowzaGoCoder.init(getApplicationContext(), “GOXX-XXXX- XXXX-XXXX-XXXX-XXA7”);

Step 2: Maintain some delay between Wowza player configuration and ‘play’ method of Wowza player view.

mStreamPlayerConfig = new WOWZPlayerConfig();
mStreamPlayerConfig.setIsPlayback(true);
mStreamPlayerConfig.setHostAddress("your-server-ip");
mStreamPlayerConfig.setApplicationName("live");
mStreamPlayerConfig.setStreamName("myStream");
mStreamPlayerConfig.setPortNumber(1935);<br><br>new Handler().postDelayed(new Runnable() {
    @Override
    public void run() {
        mStreamPlayerView.play(mStreamPlayerConfig, this/*WOWZStatusCallback*/);
    }
}, 1000);

Hello @Nishchay Pagarani I’m sorry you are facing this issue and thanks for sharing the error message. Can you please submit a support ticket so we can assist you with this? You can do this here:

HI I am also facing the same issue. Please let me know if you have found any solution for it. Thanks in advance

Hello,

Please make sure that your run method to create the delay looks like this:

 final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
 @Override
 public void run() {
 *WOWZStatusCallback statusCallback = new StatusCallback();*
 *mStreamPlayerView.play(mStreamPlayerConfig, statusCallback);*
 *}*
 *}, 1000);*
 *}*
*}*

Regards,

Jason