|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.datamodel.ifs.MCRAudioVideoExtender
public abstract class MCRAudioVideoExtender
For MCRFiles that contain streaming audio/video, instances of this class provide methods to get technical metadata like bitrate, framerate, duration, size etc. and to start a player to stream the asset to a browser.
| Field Summary | |
|---|---|
static boolean |
AUDIO
Constant for media type = audio |
protected String |
baseMetadata
The base URL of a cgi that provides technical metadata about the asset |
protected String |
basePlayerStarter
The base URL where to get a metafile that starts a player in browser |
protected int |
bitRate
The bitrate of the asset in number of bits per second |
protected String |
contentTypeID
The content type of the asset |
protected int |
durationHours
The hours part of the duration of the asset |
protected int |
durationMinutes
The minutes part of the duration of the asset |
protected int |
durationSeconds
The seconds part of the duration of the asset |
protected MCRFileReader |
file
The asset file this extender belongs to |
protected double |
frameRate
The framerate of the asset in number of frames per second |
protected boolean |
mediaType
The media type of the asset, either AUDIO or VIDEO |
protected String |
playerDownloadURL
The URL where clients can download a player for the asset |
protected String |
playerStarterCT
The MIME type a servlet has to send with the player starter |
protected long |
size
The size of the asset in bytes |
static boolean |
VIDEO
Constant for media type = video |
| Constructor Summary | |
|---|---|
MCRAudioVideoExtender()
Creates a new MCRAudioVideoExtender. |
|
| Method Summary | |
|---|---|
protected void |
forwardData(URLConnection connection,
OutputStream out)
Helper method that reads all data from an URLConnection input stream and forwards it to the given output stream. |
protected String |
getBetween(String prefix,
String suffix,
String data,
String defaultValue)
Helper method to get a substring that lies between a prefix and a suffix string. |
int |
getBitRate()
Returns the maximum number of bits per seconds when asset is streamed |
String |
getBitRateFormatted()
Returns the streaming bitrate formatted as a String, e. |
protected URLConnection |
getConnection(String url)
Helper method that creates a URLConnection to a given URL and wraps possible IOException or MalformedURLExceptions |
protected int |
getConnectTimeout()
|
String |
getContentTypeID()
Returns the ID of the content type of this asset |
String |
getDurationFormatted(String hourLabel,
String minutesLabel,
String secondsLabel)
Returns the duration of this asset, formatted as a String for output. |
int |
getDurationHours()
Returns the hours part of the duration of this asset |
int |
getDurationMinutes()
Returns the minutes part of the duration of this asset |
int |
getDurationSeconds()
Returns the seconds part of the duration of this asset |
String |
getDurationTimecode()
Returns the duration of the asset, formatted as a timcode, e. |
double |
getFrameRate()
Returns the maximum number of frames per second for a streaming video asset |
String |
getFrameRateFormatted()
Returns the framerate formatted as a String, e. |
boolean |
getMediaType()
Returns the media type, either AUDIO od VIDEO for this asset |
protected String |
getMetadata(String url)
Helper method that connects to the given URL and returns the response as a String |
String |
getPlayerDownloadURL()
Returns the URL where clients can download a player for this asset |
String |
getPlayerStarterContentType()
Returns the MIME type a servlet has to set in the HTTP response that delivers the player starter metafile to the browser |
abstract void |
getPlayerStarterTo(OutputStream out,
String startPos,
String stopPos)
Writes a metafile that starts a streaming player for this asset to an OutputStream, e. |
long |
getSize()
Returns the asset size in number of bytes. |
String |
getSizeFormatted()
Returns the asset size, formatted as a String. |
void |
init(MCRFileReader file)
Initializes this AudioVideoExtender and gets technical metadata from the server that holds the streaming asset. |
boolean |
isAudio()
Returns true, if this asset is an audio asset. |
boolean |
isVideo()
Returns true, if this asset is a video asset. |
String |
toString()
Returns a string representation of this extender's data, useful for debugging. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean VIDEO
public static final boolean AUDIO
protected int bitRate
protected double frameRate
protected boolean mediaType
protected int durationHours
protected int durationMinutes
protected int durationSeconds
protected long size
protected String contentTypeID
protected String playerDownloadURL
protected String playerStarterCT
protected String basePlayerStarter
protected String baseMetadata
protected MCRFileReader file
| Constructor Detail |
|---|
public MCRAudioVideoExtender()
| Method Detail |
|---|
public void init(MCRFileReader file)
throws MCRException
file - the MCRFile that this extender belongs to
MCRExceptionpublic int getBitRate()
public String getBitRateFormatted()
public double getFrameRate()
public String getFrameRateFormatted()
public boolean getMediaType()
public boolean isAudio()
public boolean isVideo()
public int getDurationHours()
public int getDurationMinutes()
public int getDurationSeconds()
public String getDurationFormatted(String hourLabel,
String minutesLabel,
String secondsLabel)
hourLabel - the label for the hours part of the durationminutesLabel - the label for the minutes part of the durationsecondsLabel - the label for the seconds part of the duration
public String getDurationTimecode()
public long getSize()
public String getSizeFormatted()
public String getContentTypeID()
public String getPlayerDownloadURL()
public abstract void getPlayerStarterTo(OutputStream out,
String startPos,
String stopPos)
throws MCRPersistenceException
out - the OutputStream to write the player starter tostartPos - the optional start position in the format "hh:mm:ss"stopPos - the optional stop position in the format "hh:mm:ss"
MCRPersistenceExceptionpublic String getPlayerStarterContentType()
public String toString()
toString in class Object
protected String getBetween(String prefix,
String suffix,
String data,
String defaultValue)
prefix - the string before the substringsuffix - the string after the substringdata - the string to search throughdefaultValue - the default to return when no match is found
protected void forwardData(URLConnection connection,
OutputStream out)
throws IOException
connection - the URLConnection to get the InputStream fromout - the OutputStream to write the bytes to
IOException
protected URLConnection getConnection(String url)
throws MCRPersistenceException
url - the URL to connect to
MCRPersistenceException
protected String getMetadata(String url)
throws MCRPersistenceException
url - the URL to connect to
MCRPersistenceExceptionprotected int getConnectTimeout()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||