Skip to content

Commit

Permalink
kotlinified expression plus removed commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
mzorz committed Aug 13, 2019
1 parent 26767fc commit e0f25fa
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,10 @@ class VideoPlayingBasicHandling : Fragment(), SurfaceFragmentHandler {
stopVideoPlay()
}

if (currentFile != null && currentFile!!.exists()) {
// val assetManager = context?.assets
// val descriptor = assetManager!!.openFd("small.mp4")
val inputStream = FileInputStream(currentFile)
currentFile?.takeIf { it.exists() }?.let { file ->
val inputStream = FileInputStream(file)
mediaPlayer = MediaPlayer().apply {
setDataSource(inputStream.getFD())
// setDataSource("http://techslides.com/demos/sample-videos/small.mp4")
// setDataSource(descriptor?.getFileDescriptor(), descriptor.getStartOffset(), descriptor.getLength())
setSurface(s)
prepare()
// TODO check whether we want fine grained error handling by setting these listeners
Expand All @@ -154,7 +150,6 @@ class VideoPlayingBasicHandling : Fragment(), SurfaceFragmentHandler {
setAudioStreamType(AudioManager.STREAM_MUSIC)
start()
}
// descriptor?.close()
}
} catch (e: IllegalArgumentException) {
// TODO Auto-generated catch block
Expand Down

0 comments on commit e0f25fa

Please sign in to comment.