Interface Media
- All Known Implementing Classes:
AudioBook,EBook,VideoMaterial
public interface Media
Interface for materials with multimedia content.
Demonstrates interface segregation principle and multiple inheritance through interfaces.
This interface defines behavior for audio and video materials, including duration, format, and playback capabilities.
- Since:
- 2024-09-15
- Version:
- 2.0
- Author:
- Navid Mohaghegh
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumQuality levels for media content. -
Method Summary
Modifier and TypeMethodDescriptiondefault intestimateDownloadTime(double mbps) Calculates estimated download time based on connection speed.intGets the duration of the media in minutes.doubleGets the file size in megabytes.Gets the file format of the media.default StringGets playback information as a formatted string.Gets the quality setting for the media.booleanChecks if the media requires an internet connection.
-
Method Details
-
getDuration
int getDuration()Gets the duration of the media in minutes.- Returns:
- duration in minutes
-
getFormat
String getFormat()Gets the file format of the media.- Returns:
- format string (e.g., "MP3", "MP4", "WAV")
-
getFileSize
double getFileSize()Gets the file size in megabytes.- Returns:
- size in MB
-
isStreamingOnly
boolean isStreamingOnly()Checks if the media requires an internet connection.- Returns:
- true if streaming required, false if downloadable
-
getQuality
-
getPlaybackInfo
Gets playback information as a formatted string.- Returns:
- playback details
-
estimateDownloadTime
default int estimateDownloadTime(double mbps) Calculates estimated download time based on connection speed.- Parameters:
mbps- download speed in megabits per second- Returns:
- estimated time in seconds
-