Exemple #1
0
        public virtual async Task <OperationResult> ConvertWithSubtitles([FromBody] RecordingActionRequestDto input)
        {
            try
            {
                string licenseKey = LmsCompany.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceWithSubtitlesLicenseKey);
                if (string.IsNullOrWhiteSpace(licenseKey))
                {
                    throw new WarningMessageException("Can't find your MP4Service license. Contact administrator.");
                }

                Guid license;
                if (!Guid.TryParse(licenseKey, out license))
                {
                    throw new WarningMessageException("Invalid MP4Service license. Contact administrator.");
                }

                return(await Mp4ApiUtility.DoConvert(Mp4Client,
                                                     license,
                                                     MP4Service.Contract.Client.LicenseType.MP4WithSubtitles,
                                                     input.RecordingId,
                                                     null,
                                                     Logger).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                string errorMessage = GetOutputErrorMessage("ConvertWithSubtitles", ex);
                return(OperationResult.Error(errorMessage));
            }
        }
Exemple #2
0
        public virtual async Task <OperationResultWithData <Mp4TaskStatusDto> > GetRecordingStatus([FromBody] RecordingActionRequestDto input)
        {
            try
            {
                Guid mp4;
                if (!Guid.TryParse(LmsCompany.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceLicenseKey), out mp4))
                {
                    mp4 = Guid.Empty;
                }
                Guid mp4Subtitles;
                if (!Guid.TryParse(LmsCompany.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceWithSubtitlesLicenseKey), out mp4Subtitles))
                {
                    mp4Subtitles = Guid.Empty;
                }

                if ((mp4 != Guid.Empty) || (mp4Subtitles != Guid.Empty))
                {
                    var mp4Client = IoC.Resolve <TaskClient>();
                    return(await Mp4ApiUtility.GetRecordingStatus(mp4Client, input.RecordingId,
                                                                  mp4,
                                                                  mp4Subtitles,
                                                                  _mp4LinkBuilder,
                                                                  _vttLinkBuilder,
                                                                  Logger));
                }

                return(OperationResultWithData <Mp4TaskStatusDto> .Error("No MP4 license found"));
            }
            catch (Exception ex)
            {
                string errorMessage = GetOutputErrorMessage("MP4-GetRecordings", ex);
                return(OperationResultWithData <Mp4TaskStatusDto> .Error(errorMessage));
            }
        }