OpenVidu / openvidu

OpenVidu Platform main repository
https://openvidu.io
Apache License 2.0
1.86k stars 464 forks source link

Broadcasting/Recording fail for outputMode as INDIVIDUAL in the defaultRecordingProperties of the session #801

Closed abdul-mueed-shz closed 1 year ago

abdul-mueed-shz commented 1 year ago

Describe the bug We are using OpenVidu Pro 2.27.0. While creating the openVidu session using the rest api for the defaultRecordingProperties I am setting outputMode as INDIVIDUAL. The default output mode is COMPOSED. The recording is created sucessfully when I am using the COMPOSED output mode. But for INDIVIDUAL recording mode, The zip file which is created which should have separate recordings of all the streams has only a single json file and the files array in the json file is empty. Similar to this If I try to broadcast a session which has the outputMode set as INDIVIDUAL , I get an internal server error(500) from the openVidu server. But for the COMPOSED output mode the session is broadcasted sucessfully. I am using the openVidu rest apis to perform the actions described above and I am using Django Rest Framewok as my application server:

Expected behavior Irrespective of the outputMode the session streams should be successfully recorded or broadcasted. For the INDIVIDUAL output mode the zip file created should have the recording files of all the session streams and the session should be broadcasted sucessfully

Wrong current behavior For the INDIVIDUAL output mode of the defaultRecordingProperties the zip file created has no recording files and the server throws an internal server error when It is tried to broadcast the session.

OpenVidu tutorial where to replicate the error This is an intermittent issue, there are no particular steps involved to reproduce the issue. Only clue is that every time it occurred, a large file more than 1GB was involved.

Additional context The code for creating the session is:

` @action(detail=False, methods=['get'], url_path='(?P.+)/session') def create_session(self, request, paper_code): if request_has_any_right(self.request, [UserRight.ATTEMPT_EXAM]): user = request.user user_exam = get_object_or_404(UserExam, user=request.user, paper__code=paper_code, exam__entity=user.entity, is_deleted=False)

        if user_exam.status == SUBMITTED or user_exam.status == MARKED:
            return Response({'error': EXAM_ALREADY_SUBMITTED}, status=status.HTTP_400_BAD_REQUEST)

        user_exam_id = str(user_exam.pk)
        session_id = self.LIVESTREAM_SESSION_PREFIX + user_exam_id
        broadcast_id = self.LIVESTREAM_BROADCAST_PREFIX + user_exam_id
        try:
            examinee_user = user_exam.user
            recording_file_name = slugify(session_id + '-' + str(examinee_user.userprofile)
                                          if examinee_user.userprofile else str(examinee_user))

            body = {'customSessionId': session_id,
                    'recordingMode': settings.LIVESTREAM_RECORDING_MODE,
                    'defaultRecordingProperties': {
                        'name': recording_file_name,
                        "outputMode": "INDIVIDUAL",
                        'hasAudio': True,
                        'hasVideo': True}
                    }
            response = requests.post(
                url=self.LIVESTREAM_API_URL + 'sessions',
                auth=self.LIVESTREAM_AUTH,
                headers=self.LIVESTREAM_HEADERS,
                verify=settings.LIVESTREAM_SSL_VERIFY,
                json=body
            )
            response.raise_for_status()
            # broadcast_response.raise_for_status()
            return Response({'session': user_exam.pk, 'broadcast_identifier': broadcast_id},
                            status=status.HTTP_200_OK)
        except requests.exceptions.HTTPError as err:
            if err.response.status_code == 409:
                # Session already exists in OpenVidu
                return Response({'session': user_exam.pk, 'broadcast_identifier': broadcast_id},
                                status=status.HTTP_200_OK)
            else:
                raise exceptions.APIException()
    else:
        raise exceptions.PermissionDenied()

`

pabloFuente commented 1 year ago

I am not sure I have fully understood the problem. Are you saying that it is impossible to perform an INDIVIDUAL recording of a Session, and at the same time broadcast it?

abdul-mueed-shz commented 1 year ago

No, I think the recording issue is related to something wrong with our configuration. Our main point of focus was that we cannot broadcast individual streams to an rtmp url. You replied to us through the openVidu support email. We got our answer now that it's not possible to broadcast streams in the individual mode. I think we can close this issue now. Thanks a lot for your cooperation and quick reply.