java.lang.Object
java.lang.Record
one.jpro.platform.media.MediaSource
- Record Components:
source- string form of a media source URIisLocal-trueif this media source is local when running on a desktop/mobile or as a local resource to JPro server, otherwisefalsewhen inside the client's browserjsFile- the non-local media source located inside the client's browser
public record MediaSource(String source, boolean isLocal, com.jpro.webapi.WebAPI.JSFile jsFile)
extends Record
The
MediaSource class represents a media resource.
It is instantiated from the string form of a source URI
or WebAPI.JSFile depending on whenever the resource is
available locally, on the JPro server or in the browser's client.
The same MediaSource object may be shared among multiple
MediaPlayer or MediaRecorder objects.
- Author:
- Besmir Beqiri
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMediaSource(com.jpro.webapi.WebAPI.JSFile jsFile) Construct a media source for the givenWebAPI.JSFileobject.MediaSource(File file) Construct a media source for the givenFileobject.MediaSource(String source) Construct a media source for the given URI string.MediaSource(String source, boolean isLocal, com.jpro.webapi.WebAPI.JSFile jsFile) Compact constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.file()Returns the local file representing this media source.final inthashCode()Returns a hash code value for this object.booleanisLocal()Returns the value of theisLocalrecord component.com.jpro.webapi.WebAPI.JSFilejsFile()Returns the value of thejsFilerecord component.source()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MediaSource
Compact constructor.- Throws:
NullPointerException- if the source isnull.IllegalArgumentException- if the source is not a valid URI.
-
MediaSource
Construct a media source for the given URI string.- Parameters:
source- a URI string
-
MediaSource
public MediaSource(com.jpro.webapi.WebAPI.JSFile jsFile) Construct a media source for the givenWebAPI.JSFileobject.- Parameters:
jsFile- a JS file retrieved from the client's browser.
-
MediaSource
Construct a media source for the givenFileobject.- Parameters:
file- a local file
-
-
Method Details
-
file
Returns the local file representing this media source.- Returns:
- an optional file object.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-
isLocal
public boolean isLocal()Returns the value of theisLocalrecord component.- Returns:
- the value of the
isLocalrecord component
-
jsFile
public com.jpro.webapi.WebAPI.JSFile jsFile()Returns the value of thejsFilerecord component.- Returns:
- the value of the
jsFilerecord component
-