---
title: AudioVideoService
summary: API reference for AudioVideoService.
status: draft
owner: <owner>
last_reviewed: 2026-09-15
library: SAIF.Application.Services.AudioVideo
reference_type: package
---

# 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](../../operations/import-recording.md), and implements the remaining public operations ([OP-AV-02](../../operations/invalidate-recording.md) through [OP-AV-05](../../operations/has-media.md)).

## 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](../../operations/import-recording.md); enforces [BR-AV-01](../../business-rules.md#br-av-01-currentuserid-required) through [BR-AV-05](../../business-rules.md#br-av-05-description-length-limit) via `AudioVideoValidator` and [BR-AV-09](../../business-rules.md#br-av-09-import-requires-vendor-deletion). |
| InvalidateRecording | `public void InvalidateRecording(CallRecording recording)` | Removes tracked import status and flags the recording invalid in the vendor system (see [OP-AV-02](../../operations/invalidate-recording.md), [BR-AV-10](../../business-rules.md#br-av-10-invalidate-annotates-vendor-description)); 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](../../operations/cancel-import.md)); 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](../../operations/get-recording-info.md)); 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](../../operations/has-media.md)); 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](../../operations/mark-import-status-errored.md)); throws `NotImplementedException` in reduced-capability mode. |
| Dispose | `public void Dispose()` (from `IDisposable`) | Disposes the underlying `IRecordingSystem` connection, if present. |

## Behavioral notes
- The `_enableServicesFlag`, set `false` only by the reduced constructor, gates every public member except `HasMedia`; disabled members throw `NotImplementedException("Function not valid in this instance")`.
- `ImportRecording` deletes the local `Recording` row 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](../../business-rules.md#br-av-09-import-requires-vendor-deletion) for the related vendor-deletion outcome).
- File conversion uses `MediaToolkit.Engine` to 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 `HasMedia` should 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.cs`
- `Application\SAIF.Application.Services.AudioVideo\Core\Services\IAudioVideoService.cs`
