mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
properly play videos if their filename contains a colon
This commit is contained in:
parent
b8dd4bd5ab
commit
119276672a
2 changed files with 7 additions and 2 deletions
|
@ -46,7 +46,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.13.6'
|
||||
implementation 'com.simplemobiletools:commons:3.13.7'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
|
||||
implementation 'com.android.support:multidex:1.0.2'
|
||||
implementation 'com.google.code.gson:gson:2.8.2'
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.view.animation.AnimationUtils
|
|||
import android.widget.SeekBar
|
||||
import android.widget.TextView
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.gallery.BuildConfig
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.activities.VideoActivity
|
||||
import com.simplemobiletools.gallery.extensions.*
|
||||
|
@ -21,6 +22,7 @@ import com.simplemobiletools.gallery.helpers.MEDIUM
|
|||
import com.simplemobiletools.gallery.helpers.MediaSideScroll
|
||||
import com.simplemobiletools.gallery.models.Medium
|
||||
import kotlinx.android.synthetic.main.pager_video_item.view.*
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
||||
class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener {
|
||||
|
@ -315,9 +317,12 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||
}
|
||||
|
||||
val mediumPath = if (wasEncoded) mEncodedPath else getPathToLoad(medium)
|
||||
|
||||
// this workaround is needed for example if the filename contains a colon
|
||||
val fileUri = if (mediumPath.startsWith("/")) context!!.getFilePublicUri(File(mediumPath), BuildConfig.APPLICATION_ID) else Uri.parse(mediumPath)
|
||||
try {
|
||||
mMediaPlayer = MediaPlayer().apply {
|
||||
setDataSource(context, Uri.parse(mediumPath))
|
||||
setDataSource(context, fileUri)
|
||||
setDisplay(mSurfaceHolder)
|
||||
setOnCompletionListener { videoCompleted() }
|
||||
setOnVideoSizeChangedListener { mediaPlayer, width, height -> setVideoSize() }
|
||||
|
|
Loading…
Reference in a new issue