Skip to content

Commit

Permalink
v4.2.2, try to fix webms again
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamantcheese committed Jun 9, 2019
1 parent 8815f6c commit 21f83fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Kuroba/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
//bump the MINOR (YY) version when there are compatible changes between versions (ie database changes)
//or if there are big application level changes like tearing out/adding major features
//bump the PATCH (ZZ) version otherwise, for anything small
versionCode 40201
versionName "v4.2.1"
versionCode 40202
versionName "v4.2.2"

applicationId "com.github.adamantcheese.chan"
//this is your update endpoint, change it to your repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
Expand Down Expand Up @@ -54,6 +56,8 @@

import java.io.File;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.inject.Inject;

Expand All @@ -62,7 +66,6 @@

import static com.github.adamantcheese.chan.Chan.inject;
import static com.github.adamantcheese.chan.utils.AndroidUtils.getAppContext;
import static com.github.adamantcheese.chan.utils.AndroidUtils.runOnUiThread;

public class MultiImageView extends FrameLayout implements View.OnClickListener, AudioListener, LifecycleObserver {
public enum Mode {
Expand Down Expand Up @@ -91,6 +94,7 @@ public enum Mode {
private FileCacheDownloader videoRequest;

private SimpleExoPlayer exoPlayer;
private ExecutorService threadPool = Executors.newCachedThreadPool();

private boolean backgroundToggle;

Expand Down Expand Up @@ -391,21 +395,24 @@ private void setVideo(String videoUrl) {
}

private void openVideoInternalStream(String videoUrl) {
runOnUiThread(() -> fileCache.createMediaSource(videoUrl, source -> {
PlayerView exoVideoView = new PlayerView(getContext());
exoPlayer = ExoPlayerFactory.newSimpleInstance(getContext());
exoVideoView.setPlayer(exoPlayer);

exoPlayer.setRepeatMode(ChanSettings.videoAutoLoop.get() ?
Player.REPEAT_MODE_ALL : Player.REPEAT_MODE_OFF);

exoPlayer.prepare(source);
exoPlayer.addAudioListener(MultiImageView.this);

addView(exoVideoView);
exoPlayer.setPlayWhenReady(true);
onModeLoaded(Mode.MOVIE, exoVideoView);
callback.onVideoLoaded(MultiImageView.this);
threadPool.execute(() -> fileCache.createMediaSource(videoUrl, source -> {
Handler h = new Handler(Looper.getMainLooper());
h.post(() -> {
PlayerView exoVideoView = new PlayerView(getContext());
exoPlayer = ExoPlayerFactory.newSimpleInstance(getContext());
exoVideoView.setPlayer(exoPlayer);

exoPlayer.setRepeatMode(ChanSettings.videoAutoLoop.get() ?
Player.REPEAT_MODE_ALL : Player.REPEAT_MODE_OFF);

exoPlayer.prepare(source);
exoPlayer.addAudioListener(MultiImageView.this);

addView(exoVideoView);
exoPlayer.setPlayWhenReady(true);
onModeLoaded(Mode.MOVIE, exoVideoView);
callback.onVideoLoaded(MultiImageView.this);
});
}));
}

Expand Down

0 comments on commit 21f83fd

Please sign in to comment.