File Input
Dynamically play MP4, TS files, or static images (JPG/PNG) via API calls
Features
-
Dynamic Playback: Creates file input nodes on-demand via API calls
-
Format Support: Automatically detects and plays MP4 files (TS support planned)
-
Progress Tracking: Real-time playback progress with duration and position
-
API Control: RESTful endpoints for play, stop, and status operations
-
Stream Mapping: Flexible output stream configuration
-
Error Handling: Graceful handling of file access errors from Norsk container
Component Configuration
Option | Description | Required |
---|---|---|
id |
A unique identifier for the component instance |
✓ |
displayName |
The name shown in the Studio UI of this component |
✓ |
sourceName |
Source name for the output streams (default: "file-source") |
✗ |
streamMappings |
Advanced stream mapping for this input |
✗ |
notes |
Additional notes about this component |
✗ |
initialFilename |
File to start playing automatically on component startup |
✗ |
initialLoop |
Whether to loop the initial file continuously |
✗ |
API Endpoints
The component provides the following REST API endpoints for dynamic control:
POST /play
Starts playback of a specified file.
Request Body:
{
"filePath": "/path/to/file.mp4"
}
Response:
- 200 OK
: Playback started successfully
- 400 Bad Request
: Invalid request (missing filePath or already playing)
- 500 Internal Server Error
: Failed to start playback
Usage Examples
File Requirements
-
Files must be accessible to the Norsk container (not the Studio container)
-
Use absolute file paths
-
Supported formats: MP4 (TS support planned)
-
Files are automatically cleaned up after playback completion
Behavior
-
Startup: Component starts in
idle
state with no active file -
Playback: Creates appropriate file input node (fileMp4 for .mp4 files)
-
Progress: Updates progress every second during playback
-
Completion: Automatically cleans up and returns to
idle
state -
Error Recovery: Failed operations set component to
error
state with details
Stream Output
The component produces audio and video streams according to the configured stream mappings. By default, it creates:
-
Video stream:
sourceName
/ program 1 / stream 256 / rendition "default" -
Audio stream:
sourceName
/ program 1 / stream 257 / rendition "default"
Stream mappings can be customized to route outputs to different destinations or apply filtering.