3

one2many コールのチュートリアル、one2many コールの高度なチュートリアル、および hello-world の記録から少し離れて作業していますが、記録を機能させることができないようです。ファイルを作成しますが、常に 382 バイトで、再生可能なコンテンツはありません。エラーは発生せず、ブラウザとアプリ サーバー間の通信も問題なく動作しています。

最初の記録要求を処理するコードは次のようになります。

       //1. Media logic
        BroadcastPipeline broadcastPipeline = new BroadcastPipeline(kurento, "test-broadcast");

        //2. User session
        broadcasterUserSession = new UserSession(session);
        broadcasterUserSession.setWebRtcEndpoint(broadcastPipeline.getWebRtcEndpoint());

        //3. SDP negotiation
        String broadcastSdpOffer = jsonMessage.get("sdpOffer").getAsString();
        String broadcastSdpAnswer = broadcastPipeline.generateSdpAnswerForBroadcaster(broadcastSdpOffer);

        //4. Gather ICE candidates
        broadcastPipeline.getWebRtcEndpoint().addOnIceCandidateListener(
                new EventListener<OnIceCandidateEvent>() {

                    @Override
                    public void onEvent(OnIceCandidateEvent event) {
                        JsonObject response = new JsonObject();
                        response.addProperty("id", "iceCandidate");
                        response.add("candidate", JsonUtils.toJsonObject(event.getCandidate()));
                        try {
                            synchronized (session) {
                                session.sendMessage(new TextMessage(response.toString()));
                            }
                        } catch (IOException e) {
                            log.debug(e.getMessage());
                        }
                    }
                });

        JsonObject startBroadcast = new JsonObject();

        startBroadcast.addProperty("id", "broadcasterResponse");
        startBroadcast.addProperty("response", "accepted");
        startBroadcast.addProperty("sdpAnswer", broadcastSdpAnswer);

        synchronized (broadcasterUserSession){
            session.sendMessage(new TextMessage(startBroadcast.toString()));
        }

        broadcastPipeline.getWebRtcEndpoint().gatherCandidates();

        broadcastPipeline.startRecording();

UserSession は、hello-world-recording とほぼ同じです。ただし、BroadcastMediaPipeline は次のようになります。

public static final String RECORDING_PATH = "file:///tmp/";
public static final String RECORDING_EXT = ".webm";

private final MediaPipeline mediaPipeline;
private final WebRtcEndpoint webRtcEndpoint;
private final RecorderEndpoint recorderEndpoint;

public BroadcastPipeline(KurentoClient kurento, String broadcastTitle){
    log.info("Creating Broadcast pipeline");

    //Create the media pipeline
    mediaPipeline = kurento.createMediaPipeline();

    //Create the broadcaster pipeline
    webRtcEndpoint = new WebRtcEndpoint.Builder(mediaPipeline).build();

    //Create the recording endpoint for the broadcast
    recorderEndpoint = new RecorderEndpoint.Builder(mediaPipeline, RECORDING_PATH + broadcastTitle + RECORDING_EXT).build();

    webRtcEndpoint.connect(recorderEndpoint);
}

public void startRecording(){
    try{
        recorderEndpoint.record();
        log.info("Started recording broadcast");
    }
    catch(Exception e){
        log.error("Something bad happended: + " + e.getMessage());
    }
}
public MediaPipeline getMediaPipeline(){
    return mediaPipeline;
}

public String generateSdpAnswerForBroadcaster(String sdpOffer){
    return webRtcEndpoint.processOffer(sdpOffer);
}

public WebRtcEndpoint getWebRtcEndpoint(){
    return webRtcEndpoint;
}

public WebRtcEndpoint buildViewerEndpoint(){
    return (new WebRtcEndpoint.Builder(mediaPipeline).build());
}

これを解決するためにさらに情報が必要な場合は、提供します。

4

2 に答える 2

2

次のような RecorderEndpoint でメディア プロファイルを設定していることを確認します。

recorderCaller
                = new RecorderEndpoint.Builder(pipeline, RECORD_PATH)
                        .stopOnEndOfStream()
                        .withMediaProfile(isAudioOnly ? MediaProfileSpecType.MP4_AUDIO_ONLY : MediaProfileSpecType.MP4)
                        .build();
            hubportCaller.connect(recorderCaller);
            recorderCaller.record();
于 2015-12-05T11:52:31.947 に答える