Back to Exoplayer

FakeMediaChunk (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/testutil/FakeMediaChunk.html

latest5.8 KB
Original Source

Package com.google.android.exoplayer2.testutil

Class FakeMediaChunk


public final classFakeMediaChunkextends[MediaChunk](../source/chunk/MediaChunk.html "class in com.google.android.exoplayer2.source.chunk")

Fake MediaChunk.

Field Summary

- 

Fields inherited from class com.google.android.exoplayer2.source.chunk.MediaChunk

chunkIndex

- 

Fields inherited from class com.google.android.exoplayer2.source.chunk.Chunk

dataSource, dataSpec, endTimeUs, loadTaskId, startTimeUs, trackFormat, trackSelectionData, trackSelectionReason, type

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | FakeMediaChunk​(Format trackFormat, long startTimeUs, long endTimeUs) | Creates a fake media chunk. | | FakeMediaChunk​(Format trackFormat, long startTimeUs, long endTimeUs, @com.google.android.exoplayer2.C.SelectionReason int selectionReason) | Creates a fake media chunk. |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | cancelLoad() | Cancels the load. | | boolean | isLoadCompleted() | Returns whether the chunk has been fully loaded. | | void | load() | Performs the load, returning on completion or cancellation. |

- 

Methods inherited from class com.google.android.exoplayer2.source.chunk.MediaChunk

getNextChunkIndex

- 

Methods inherited from class com.google.android.exoplayer2.source.chunk.Chunk

bytesLoaded, getDurationUs, getResponseHeaders, getUri

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

FakeMediaChunk

public FakeMediaChunk​([Format](../Format.html "class in com.google.android.exoplayer2")trackFormat,
                      long startTimeUs,
                      long endTimeUs)

Creates a fake media chunk. Parameters:trackFormat - The Format.startTimeUs - The start time of the media, in microseconds.endTimeUs - The end time of the media, in microseconds.

- 

FakeMediaChunk

public FakeMediaChunk​([Format](../Format.html "class in com.google.android.exoplayer2")trackFormat,
                      long startTimeUs,
                      long endTimeUs,
                      @com.google.android.exoplayer2.C.SelectionReason int selectionReason)

Creates a fake media chunk. Parameters:trackFormat - The Format.startTimeUs - The start time of the media, in microseconds.endTimeUs - The end time of the media, in microseconds.selectionReason - One of the selection reasons.

Method Detail

- 

cancelLoad

public void cancelLoad()

Description copied from interface: Loader.Loadable

Cancels the load.

Loadable implementations should ensure that a currently executing Loader.Loadable.load() call will exit reasonably quickly after this method is called. The Loader.Loadable.load() call may exit either by returning or by throwing an IOException.

If there is a currently executing Loader.Loadable.load() call, then the thread on which that call is being made will be interrupted immediately after the call to this method. Hence implementations do not need to (and should not attempt to) interrupt the loading thread themselves.

Although the loading thread will be interrupted, Loadable implementations should not use the interrupted status of the loading thread in Loader.Loadable.load() to determine whether the load has been canceled. This approach is not robust [Internal ref: b/79223737]. Instead, implementations should use their own flag to signal cancelation (for example, using AtomicBoolean).

- 

load

public void load()

Description copied from interface: Loader.Loadable

Performs the load, returning on completion or cancellation.

- 

isLoadCompleted

public boolean isLoadCompleted()

Description copied from class: MediaChunk

Returns whether the chunk has been fully loaded. Specified by:isLoadCompleted in class MediaChunk