Permalink
Browse files

if Media object didn't have duration, set it when we know it

  • Loading branch information...
1 parent 8441773 commit e8dd65a4536dd734662ff8d69b59e55db3bd133d @vitriolix vitriolix committed Apr 2, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 app/src/info/guardianproject/mrapp/PreviewVideoView.java
@@ -91,13 +91,21 @@ public void onPrepared(MediaPlayer mp) {
private void doPlay() {
Media media = mMediaArray[mCurrentMedia];
+ if (media.getDuration() == 0) {
+ // old projects didn't save duration, we need it
+ media.setDuration(getDuration());
+ media.save();
+ }
+
if ((media.getTrimStart() > 0) && (media.getTrimStart() < 99)) {
- seekTo(media.getTrimmedStartTime());
+ int startTime = media.getTrimmedStartTime();
+ seekTo(startTime);
}
if ((media.getTrimEnd() != 0) && (media.getTrimEnd() < 99)) {// && (media.getTrimStart() < media.getTrimEnd())) {
mHandler.removeCallbacks(mTrimClipEndTask);
- mHandler.postDelayed(mTrimClipEndTask, media.getTrimmedDuration());
+ int duration = media.getTrimmedDuration();
+ mHandler.postDelayed(mTrimClipEndTask, duration);
}
start();

0 comments on commit e8dd65a

Please sign in to comment.