AudioVideoService¶
AudioVideoService is the library's single concrete IAudioVideoService implementation. It orchestrates request validation, recording persistence, backup-file copying, audio transcoding, import verification, and vendor-system deletion for OP-AV-01 Import recording, and implements the remaining public operations (OP-AV-02 through OP-AV-05).
Purpose¶
- Implement the full recording-import workflow: validate, locate-or-create the persisted recording, back up and transcode the source file, verify the result, and delete the source from the vendor system.
- Implement recording invalidation, import cancellation, recording lookup, and claim media-presence checks.
- Support a reduced-capability construction mode (media-check only) for callers that only need
HasMedia.
Context¶
- Namespace:
SAIF.Services.Utilities.AudioVideo - Assembly/package:
SAIF.Application.Services.AudioVideo
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| VENDOR_INPUT_AUDIO_FILE_EXTENSION | public const string VENDOR_INPUT_AUDIO_FILE_EXTENSION = "mp3" |
The expected source file extension for vendor-supplied recordings, used when computing the backup file path. |
| DESTINATION_AUDIO_FILE_EXTENSION | public const string DESTINATION_AUDIO_FILE_EXTENSION = "wma" |
The target file extension produced by transcoding, used when computing the converted file path. |
| (constructor, full) | public AudioVideoService(IUnitOfWork uow, IEnvironmentService environmentService, IImportStatusManager importStatusManager, IRecordingSystem recordingSystem, IConsoleLogService logService) |
Constructs a fully-capable instance; all five arguments are required (Enforce.ArgumentNotNull) and all public operations are enabled. |
| (constructor, reduced) | public AudioVideoService(IUnitOfWork uow) |
Constructs a reduced-capability instance in which only HasMedia is functional; all other public members throw NotImplementedException. |
| ImportRecording | public RecordingInfo ImportRecording(ImportAudioRequest request) |
Executes the full import workflow described in OP-AV-01; enforces BR-AV-01 through BR-AV-05 via AudioVideoValidator and BR-AV-09. |
| InvalidateRecording | public void InvalidateRecording(CallRecording recording) |
Removes tracked import status and flags the recording invalid in the vendor system (see OP-AV-02, BR-AV-10); throws NotImplementedException in reduced-capability mode. |
| CancelImport | public void CancelImport(Guid callRecordingId) |
Removes tracked import status without contacting the vendor system (see OP-AV-03); throws NotImplementedException in reduced-capability mode. |
| GetRecordingInfo | public RecordingInfo GetRecordingInfo(Guid callRecordingId) |
Looks up a persisted recording by vendor recording ID and maps it to a RecordingInfo (see OP-AV-04); throws NotImplementedException in reduced-capability mode. |
| HasMedia | public bool HasMedia(long claimId) |
Returns whether any persisted Recording row exists for the given claim (see OP-AV-05); functional in both construction modes. |
| MarkImportStatusErrored | public void MarkImportStatusErrored(Guid callRecordingId, string reason = null) |
Marks a recording's tracked import status as errored (see OP-AV-06); throws NotImplementedException in reduced-capability mode. |
| Dispose | public void Dispose() (from IDisposable) |
Disposes the underlying IRecordingSystem connection, if present. |
Behavioral notes¶
- The
_enableServicesFlag, setfalseonly by the reduced constructor, gates every public member exceptHasMedia; disabled members throwNotImplementedException("Function not valid in this instance"). ImportRecordingdeletes the localRecordingrow if any step after creation fails, before re-throwing, so the viewer application never displays a recording whose file processing did not complete (see BR-AV-09 for the related vendor-deletion outcome).- File conversion uses
MediaToolkit.Engineto invoke ffmpeg with a fixed single-channel, 32kb/s bitrate command; if conversion fails to produce an output file, the source file is copied through unconverted rather than aborting the import.
Constraints and usage notes¶
- Callers that only need
HasMediashould use the reduced constructor to avoid requiring the four collaborator dependencies used only by the full workflow. - Instances should be disposed after use to release the underlying vendor recording-system connection.
Sources¶
Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\AudioVideoService.csApplication\SAIF.Application.Services.AudioVideo\Core\Services\IAudioVideoService.cs