Skip to content

Commit

Permalink
call to "/delete-cache" cancels all pending cache download operations
Browse files Browse the repository at this point in the history
  • Loading branch information
warren-bank committed Nov 4, 2021
1 parent 94d768c commit c6040be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -887,10 +887,20 @@ public void AirPlay_add_captions_offset(long offset) {

/**
* Delete files on internal storage used to temporarily cache video data.
* Cancel all active and pending cache download operations.
*/
public void AirPlay_delete_cache() {
if (downloadTracker != null)
downloadTracker.removeAllDownloads();

if (mediaQueue != null) {
for (int i = 0; i < mediaQueue.size(); i++) {
VideoSource sample = mediaQueue.get(i);

if (sample.useCache)
sample.updateUseCache(false);
}
}
}

// Miscellaneous methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class VideoSource {
public String caption_mimeType;
public final String referer;
public final HashMap<String, String> reqHeadersMap;
public final boolean useCache;
public boolean useCache;
public final float startPosition;
public final float stopPosition;
public final String drm_scheme;
Expand Down Expand Up @@ -147,6 +147,10 @@ public void updateCaption(String caption) {
this.caption_mimeType = caption_mimeType;
}

public void updateUseCache(boolean useCache) {
this.useCache = useCache;
}

public MediaItem getMediaItem() {
MediaItem.Builder builder = new MediaItem.Builder();

Expand Down

0 comments on commit c6040be

Please sign in to comment.