Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Fix playing of reddit hosted videos #210

Merged
merged 3 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

### Fixed
- Fix playing of reddit hosted videos ([#210](https://github.com/Tunous/Dawn/pull/210))
- Imgur images (up)loading ([#202](https://github.com/Tunous/Dawn/pull/202))

## [0.9.1] - 2020-05-05
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import me.saket.dank.BuildConfig;
import me.saket.dank.utils.VideoFormat;
import timber.log.Timber;

/**
* Reddit uses DASH for its videos, which automatically switches between video qualities
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/me/saket/dank/utils/VideoFormat.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.saket.dank.utils;

import okhttp3.HttpUrl;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.Util;

Expand All @@ -21,8 +22,10 @@ public boolean canBeCached() {
return this == OTHER;
}

@SuppressWarnings("ConstantConditions")
public static VideoFormat parse(String videoUrl) {
@C.ContentType int type = Util.inferContentType(videoUrl);
String fileName = HttpUrl.parse(videoUrl).encodedPath();
@C.ContentType int type = Util.inferContentType(fileName);

switch (type) {
case C.TYPE_DASH:
Expand Down