Livestream Youtube
369 0 2021-11-7
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_BPZaadYWyRSY
lvl.1

Germany
Offline

Hello i developed an app with the Creating a map view and waypoint tutorial.
Now i want to add a livestream to youtube.

I can see that youtube is recieving data from the app but youtube says that the data is not enough. When i put excatly the same code in the UXSDK the stream is working.
What am i missing?

I also added a Camera view with the creating a camera application tutorial.

This is my code for the streaming:


public void video(){

    try {
        primaryVideoFeed.registerLiveVideo(VideoFeeder.getInstance().getPrimaryVideoFeed(),true);
    } catch (Exception ignored) {setResultToToast("Video2");}

    live_streamconfig("rtmp://a.rtmp.youtube.com/live2/KEY");
checkstream();
}

public LiveStreamManager l;

public void live_streamconfig(String live_url) {
    initUI();
    l = DJISDKManager.getInstance().getLiveStreamManager();
    l.registerListener((x) -> {
        Log.v("Video1", "LiveStream callback:" + x);
    });
    l.setVideoSource(LiveStreamManager.LiveStreamVideoSource.Primary);
    l.setVideoEncodingEnabled(true);
    l.setLiveUrl(live_url);
    final LiveVideoResolution VIDEO_RESOLUTION_1280_720 = new LiveVideoResolution(1280, 720);
    l.setLiveVideoResolution(VIDEO_RESOLUTION_1280_720);
    l.setLiveVideoBitRate(4096);

}

public void checkstream(){

    Runnable runnable1 = new Runnable() {
        @Override
        public void run() {
            live_streaming_start();
sleep(5000);
            for (int i = 0; i <= 100000; i++) {
                if (l.isStreaming()) {
                    setResultToToast(String.valueOf(l.getLiveVideoResolution()));} else {
                    live_streaming_start();}
                ;
                sleep(5000);
            }
        }
    };
    new Thread(runnable1).start();
}


public void live_streaming_start(){
    new Thread() {
        @Override
        public void run() {
            int r = 0;
            r = l.startStream();
            l.setStartTime();
}
    }.start();
}
This is in my initUI()
try {
    primaryVideoFeed.registerLiveVideo(VideoFeeder.getInstance().getPrimaryVideoFeed(),true);
} catch (Exception ignored) { }

2021-11-7
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules