video bug fix
This commit is contained in:
parent
4e10494c64
commit
a8d5661394
|
@ -5,7 +5,7 @@
|
|||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -42,7 +42,7 @@ import static org.nuclearfog.twidda.backend.ImageLoader.Mode.ONLINE;
|
|||
import static org.nuclearfog.twidda.backend.ImageLoader.Mode.STORAGE;
|
||||
|
||||
|
||||
public class MediaViewer extends AppCompatActivity implements OnImageClickListener, OnPreparedListener, MediaPlayer.OnBufferingUpdateListener {
|
||||
public class MediaViewer extends AppCompatActivity implements OnImageClickListener, OnPreparedListener {
|
||||
|
||||
public static final String KEY_MEDIA_LINK = "link";
|
||||
public static final String KEY_MEDIA_TYPE = "mediatype";
|
||||
|
@ -105,6 +105,7 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
|
|||
|
||||
case ANGIF:
|
||||
videoWindow.setVisibility(VISIBLE);
|
||||
video_progress.setVisibility(INVISIBLE);
|
||||
Uri video = Uri.parse(link[0]);
|
||||
videoView.setOnPreparedListener(this);
|
||||
videoView.setVideoURI(video);
|
||||
|
@ -207,13 +208,11 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
|
|||
public void onPrepared(MediaPlayer mp) {
|
||||
switch (type) {
|
||||
case ANGIF:
|
||||
mp.setOnBufferingUpdateListener(this);
|
||||
mp.setLooping(true);
|
||||
mp.start();
|
||||
break;
|
||||
|
||||
case VIDEO:
|
||||
mp.setOnBufferingUpdateListener(this);
|
||||
case VIDEO_STORAGE:
|
||||
videoController.show(0);
|
||||
mp.seekTo(lastPos);
|
||||
|
@ -223,18 +222,6 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBufferingUpdate(MediaPlayer mp, int percent) {
|
||||
if (mp.isPlaying()) {
|
||||
if (video_progress.getVisibility() == VISIBLE)
|
||||
video_progress.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
if (video_progress.getVisibility() == INVISIBLE)
|
||||
video_progress.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setImage(Bitmap image) {
|
||||
float ratio = image.getWidth() / (float) width;
|
||||
int destHeight = (int) (image.getHeight() / ratio);
|
||||
|
|
|
@ -50,8 +50,7 @@
|
|||
android:id="@+id/video_load"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="invisible" />
|
||||
android:layout_gravity="center" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
|
Loading…
Reference in New Issue