Bladeren bron

New: add video view to share dialog

liweihao 6 jaren geleden
bovenliggende
commit
b5abea39b6

+ 41 - 37
src/main/java/com/bomostory/sceneeditmodule/SuperMovieMaker.kt

@@ -34,49 +34,53 @@ class SuperMovieMaker {
             scaleHeight: Int,
             mediaHelper: MediaHelper): Observable<String> {
         return Observable.create<String> { emitter ->
-            val movieBuilder = MovieMaker.Builder(mediaHelper)
-            movieBuilder.fps = FPS
-            movieBuilder.audioSources = generateAudioSource(musics,mediaHelper)
-
-            val inputSceneStatus = LinkedHashMap<Int, Int>()
-            val frameDataList = generateFrameDataList(project)
-            var bitmapIndex = 0
-            val permitCount = frameDataList.size
-            val semaphore = Semaphore(permitCount)
-            var completeCount = 0
-            emitter.onNext("$completeCount/${frameDataList.size}")
-
-            var beginTime = System.currentTimeMillis()
-            frameDataList.forEach { frameData ->
-                val i = bitmapIndex++
-                inputSceneStatus[i] = frameData.repeat
-                semaphore.acquire()
-                Completable.create {
-                    project?.story?.apply {
-                        val scene = scenes[frameData.sceneIndex]
-                        val bitmap = SceneDrawer.drawScene(context,scene, frameData.x, scaleWidth, scaleHeight)
-                        movieBuilder.addImage(i, bitmap!!).blockingSubscribe()
+            try {
+                val movieBuilder = MovieMaker.Builder(mediaHelper)
+                movieBuilder.fps = FPS
+                movieBuilder.audioSources = generateAudioSource(musics, mediaHelper)
+
+                val inputSceneStatus = LinkedHashMap<Int, Int>()
+                val frameDataList = generateFrameDataList(project)
+                var bitmapIndex = 0
+                val permitCount = frameDataList.size
+                val semaphore = Semaphore(permitCount)
+                var completeCount = 0
+                emitter.onNext("$completeCount/${frameDataList.size}")
+
+                var beginTime = System.currentTimeMillis()
+                frameDataList.forEach { frameData ->
+                    val i = bitmapIndex++
+                    inputSceneStatus[i] = frameData.repeat
+                    semaphore.acquire()
+                    Completable.create {
+                        project?.story?.apply {
+                            val scene = scenes[frameData.sceneIndex]
+                            val bitmap = SceneDrawer.drawScene(context, scene, frameData.x, scaleWidth, scaleHeight)
+                            movieBuilder.addImage(i, bitmap!!).blockingSubscribe()
+                        }
+                        it.onComplete()
                     }
-                    it.onComplete()
+                            .subscribeOn(Schedulers.computation())
+                            .subscribe {
+                                completeCount++
+                                emitter.onNext("$completeCount/${frameDataList.size}")
+                                semaphore.release()
+                            }
                 }
-                        .subscribeOn(Schedulers.computation())
-                        .subscribe {
-                            completeCount++
-                            emitter.onNext("$completeCount/${frameDataList.size}")
-                            semaphore.release()
-                        }
+                semaphore.acquire(permitCount)
+                var endTime = System.currentTimeMillis()
+                Log.d(this@SuperMovieMaker::class.java.simpleName, "draw + save duration = ${endTime - beginTime}")
+                movieBuilder.inputFilePath = movieBuilder.addInputFile(inputSceneStatus).blockingFirst()
+                emitter.onNext("Encoding video")
+                movieBuilder.build().output(outputFile).blockingSubscribe()
+            } catch (e: Exception) {
+
             }
-            semaphore.acquire(permitCount)
-            var endTime = System.currentTimeMillis()
-            Log.d(this@SuperMovieMaker::class.java.simpleName, "draw + save duration = ${endTime - beginTime}")
-            movieBuilder.inputFilePath = movieBuilder.addInputFile(inputSceneStatus).blockingFirst()
-            emitter.onNext("Encoding video")
-            movieBuilder.build().output(outputFile).blockingSubscribe()
             emitter.onComplete()
         }
     }
 
-    private fun generateAudioSource(musics: List<Music>,mediaHelper: MediaHelper): ArrayList<AudioSource> {
+    private fun generateAudioSource(musics: List<Music>, mediaHelper: MediaHelper): ArrayList<AudioSource> {
         val audioSources = ArrayList<AudioSource>()
         for (music in musics) {
             val fileName = "test${System.currentTimeMillis()}.mp3"
@@ -87,7 +91,7 @@ class SuperMovieMaker {
             audioLooperBuilder.loopDuration = music.loopDuration.toInt()
 
             val audioLooper = audioLooperBuilder.build()
-             audioLooper.output(outputFile).blockingFirst()
+            audioLooper.output(outputFile).blockingFirst()
 
             val mediaMetadataRetriever = MediaMetadataRetriever()
             mediaMetadataRetriever.setDataSource(outputFile.path)

+ 49 - 92
src/main/java/com/bomostory/sceneeditmodule/screen/movie/MovieEditActivity.kt

@@ -39,6 +39,7 @@ import com.example.tfat.myapplication.R
 import com.google.gson.Gson
 import io.reactivex.Observable
 import io.reactivex.android.schedulers.AndroidSchedulers
+import io.reactivex.disposables.Disposable
 import io.reactivex.schedulers.Schedulers
 import kotlinx.android.synthetic.main.activity_movie_edit.*
 import java.io.File
@@ -161,58 +162,6 @@ class MovieEditActivity : AppCompatActivity(),
 
     private val mediaHelper = MediaHelper()
 
-    private val editMoviePlayListener = object : MoviePlayerV2.OnMoviePlayListener {
-        override fun onMovieSceneUpdate(scene: Scene) {
-            runOnUiThread {
-                if (viewModel.sceneLiveData.value != scene) {
-                    viewModel.sceneLiveData.value = scene
-                }
-            }
-        }
-
-        override fun onMoviePlayComplete() {
-            runOnUiThread {
-                movieEditView.isBtnPanelEnable = true
-            }
-        }
-
-        override fun onMoviePlayViewUpdate(x: Int) {
-            runOnUiThread {
-                movieView.x = x
-            }
-        }
-
-        override fun onMoviePlayTimeUpdate(time: Long) {
-            runOnUiThread {
-                movieEditView.playTime = time
-            }
-        }
-    }
-
-    private val dialogMoviePlayListener = object : MoviePlayerV2.OnMoviePlayListener {
-        override fun onMovieSceneUpdate(scene: Scene) {
-            runOnUiThread {
-                if (shareDialog.scene != scene)
-                    shareDialog.scene = scene
-            }
-        }
-
-        override fun onMoviePlayViewUpdate(x: Int) {
-            runOnUiThread {
-                shareDialog.x = x
-            }
-        }
-
-        override fun onMoviePlayTimeUpdate(time: Long) {
-            runOnUiThread {
-                shareDialog.time = time
-            }
-        }
-
-        override fun onMoviePlayComplete() {
-        }
-    }
-
     companion object {
         const val PROJECT_KEY = "project_key"
         const val MUSIC_SELECT_DIALOG_TAG = "music_select_dialog_tag"
@@ -309,7 +258,33 @@ class MovieEditActivity : AppCompatActivity(),
             viewModel.musicListLiveData.value = musics
         }
 
-        moviePlayer.moviePlayListener = editMoviePlayListener
+        moviePlayer.moviePlayListener = object : MoviePlayerV2.OnMoviePlayListener {
+            override fun onMovieSceneUpdate(scene: Scene) {
+                runOnUiThread {
+                    if (viewModel.sceneLiveData.value != scene) {
+                        viewModel.sceneLiveData.value = scene
+                    }
+                }
+            }
+
+            override fun onMoviePlayComplete() {
+                runOnUiThread {
+                    movieEditView.isBtnPanelEnable = true
+                }
+            }
+
+            override fun onMoviePlayViewUpdate(x: Int) {
+                runOnUiThread {
+                    movieView.x = x
+                }
+            }
+
+            override fun onMoviePlayTimeUpdate(time: Long) {
+                runOnUiThread {
+                    movieEditView.playTime = time
+                }
+            }
+        }
     }
 
 
@@ -368,27 +343,8 @@ class MovieEditActivity : AppCompatActivity(),
     private fun showShareDialog(videoFile: File) {
         shareDialog.apply {
             val p = viewModel.project ?: return
+            file = videoFile
             project = p
-            storyPeriod = viewModel.storyPeriodLiveData.value ?: 0
-            dismissListener = DialogInterface.OnDismissListener {
-                moviePlayer.moviePlayListener = editMoviePlayListener
-                moviePlayer.init()
-
-                delayedHide(100)
-            }
-            seekBarChangedListener = object : SeekBar.OnSeekBarChangeListener {
-                override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
-                    if (fromUser) {
-                        moviePlayer.seekTo(progress.toLong())
-                    }
-                }
-
-                override fun onStartTrackingTouch(seekBar: SeekBar?) {
-                }
-
-                override fun onStopTrackingTouch(seekBar: SeekBar?) {
-                }
-            }
             onClickBomo = Runnable {
                 val pd = ProgressDialog(this@MovieEditActivity).apply {
                     setCancelable(false)
@@ -423,11 +379,6 @@ class MovieEditActivity : AppCompatActivity(),
             }
             onClickExportPdf = Runnable { onClickExportPdf() }
             onClickPrint = Runnable { onClickPrint() }
-            onClickPlay = Runnable {
-                moviePlayer.moviePlayListener = dialogMoviePlayListener
-                moviePlayer.init()
-                moviePlayer.start()
-            }
         }.show(supportFragmentManager)
     }
 
@@ -530,23 +481,27 @@ class MovieEditActivity : AppCompatActivity(),
     private fun saveMovie(onMovieSavedListener: OnMovieSavedListener) {
         val scaledWidth = resources.getDimensionPixelSize(R.dimen.movie_width)
         val scaleHeight = resources.getDimensionPixelSize(R.dimen.movie_height)
-
-        val pd = ProgressDialog(this).apply {
-            val t = viewModel.storyPeriodLiveData.value ?: 0
-            max = (t / 33).toInt()
-            setMessage("progressing")
-            setCancelable(false)
-        }
+        var disposable: Disposable? = null
 
         val project = viewModel.project ?: return
         val outputFile = FileUtils.getVideoFile(project)
-
         if (outputFile.exists()) {
             outputFile.delete()
         }
         outputFile.createNewFile()
 
-        SuperMovieMaker().make(
+        val pd = ProgressDialog(this).apply {
+            val t = viewModel.storyPeriodLiveData.value ?: 0
+            max = (t / 33).toInt()
+            setMessage("progressing")
+            setOnCancelListener {
+                disposable?.dispose()
+                onMovieSavedListener.onSaved(outputFile)
+                delayedHide(100)
+            }
+        }
+
+        disposable = SuperMovieMaker().make(
                 this,
                 outputFile,
                 project,
@@ -564,11 +519,13 @@ class MovieEditActivity : AppCompatActivity(),
                 .subscribe({
                     pd.setMessage(it)
                 }, {
-                    val msg = """
-                    Error:
-                    ${it.message}
-                """.trimIndent()
-                    AlertDialog.Builder(this).setMessage(msg).show()
+                    //                    val msg = """
+//                    Error:
+//                    ${it.message}
+//                """.trimIndent()
+//                    AlertDialog.Builder(this).setMessage(msg).show()
+//                    delayedHide(100)
+                    onMovieSavedListener.onSaved(outputFile)
                     delayedHide(100)
                 }, {
                     onMovieSavedListener.onSaved(outputFile)

+ 101 - 43
src/main/java/com/bomostory/sceneeditmodule/share/ShareDialog.kt

@@ -1,10 +1,12 @@
 package com.bomostory.sceneeditmodule.share
 
-import android.content.DialogInterface
+import android.graphics.PorterDuff
 import android.graphics.drawable.Drawable
+import android.media.MediaMetadataRetriever
 import android.os.Bundle
 import android.support.v4.app.DialogFragment
 import android.support.v4.app.FragmentManager
+import android.support.v4.content.ContextCompat
 import android.support.v7.widget.LinearLayoutManager
 import android.support.v7.widget.RecyclerView
 import android.view.LayoutInflater
@@ -12,48 +14,25 @@ import android.view.View
 import android.view.ViewGroup
 import android.widget.SeekBar
 import com.bomostory.sceneeditmodule.basicdata.Project
-import com.bomostory.sceneeditmodule.basicdata.Scene
 import com.bomostory.sceneeditmodule.utils.HorizontalItemDecoration
 import com.bomostory.sceneeditmodule.utils.TimeUtils
 import com.example.tfat.myapplication.R
-import kotlinx.android.synthetic.main.dialog_share.*
 import kotlinx.android.synthetic.main.dialog_share.view.*
 import kotlinx.android.synthetic.main.movie_item_view.view.*
+import java.io.File
+import java.util.*
 
 class ShareDialog : DialogFragment() {
 
     private val dialogTag = this::class.java.simpleName
 
-     var dismissListener: DialogInterface.OnDismissListener? = null
-
-    var seekBarChangedListener: SeekBar.OnSeekBarChangeListener? = null
+    lateinit var file: File
 
     lateinit var project: Project
 
-    var storyPeriod: Long = 0
-
-    var scene: Scene? = null
-        set(value) {
-            field = value
-            movieView_shareDialog_preview?.let {
-                it.scene = value
-            }
-        }
-
-    var x: Int = 0
-        set(value) {
-            field = value
-            movieView_shareDialog_preview?.let {
-                it.x = value
-            }
-        }
+    var timer: Timer? = null
 
-    var time: Long = 0
-        set(value) {
-            field = value
-            seekBarMoviePlay?.progress = value.toInt()
-            tv_shareDialog_time?.text = "${TimeUtils.getPlayMovieTimeFormat(time)}/${TimeUtils.getPlayMovieTimeFormat(storyPeriod)}"
-        }
+    var isPause = false
 
     var onClickEditCover = Runnable {}
     var onClickExportPdf = Runnable {}
@@ -71,9 +50,6 @@ class ShareDialog : DialogFragment() {
             movieView_shareDialog_preview.scene = project.story?.scenes?.get(0)
             tv_shareDialog_name.text = project.name
             tv_shareDialog_author.text = project.author
-            seekBarMoviePlay.max = storyPeriod.toInt()
-            tv_shareDialog_time.text = "${TimeUtils.getPlayMovieTimeFormat(time)}/${TimeUtils.getPlayMovieTimeFormat(storyPeriod)}"
-            seekBarMoviePlay.setOnSeekBarChangeListener(seekBarChangedListener)
             btn_shareDialog_editCover.setOnClickListener { onClickEditCover.run() }
             btn_shareDialog_exportPdf.setOnClickListener { onClickExportPdf.run() }
             btn_shareDialog_print.setOnClickListener { onClickPrint.run() }
@@ -82,7 +58,76 @@ class ShareDialog : DialogFragment() {
             iv_shareDialog_facebook.setOnClickListener { onClickFacebook.run() }
             iv_shareDialog_twitter.setOnClickListener { onClickTwitter.run() }
             iv_shareDialog_more.setOnClickListener { onClickMore.run() }
-            iv_shareDialog_play.setOnClickListener { onClickPlay.run() }
+
+            try {
+                val mediaMetadataRetriever = MediaMetadataRetriever()
+                mediaMetadataRetriever.setDataSource(file.path)
+
+                seekBarMoviePlay.apply {
+                    max = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION).toInt()
+                }
+
+                videoShareDialogPreview.apply {
+                    setZOrderOnTop(true)
+                    setVideoPath(file.path)
+                    setOnCompletionListener {
+                        timer?.cancel()
+                        timer?.purge()
+                        timer = null
+
+                        this@apply.iv_shareDialog_pause?.visibility = View.INVISIBLE
+                        this@apply.iv_shareDialog_play?.visibility = View.VISIBLE
+                        this@apply.seekBarMoviePlay?.progress = videoShareDialogPreview.currentPosition
+                    }
+                }
+
+                iv_shareDialog_play.setOnClickListener {
+                    it.visibility = View.INVISIBLE
+                    iv_shareDialog_pause.visibility = View.VISIBLE
+
+                    videoShareDialogPreview.start()
+                    if (timer == null) {
+                        timer = Timer()
+                        timer?.scheduleAtFixedRate(object : TimerTask() {
+                            override fun run() {
+                                activity?.runOnUiThread {
+                                    if (!isPause) {
+                                        seekBarMoviePlay.progress = videoShareDialogPreview.currentPosition
+                                        tv_shareDialog_time?.text = "${TimeUtils.getPlayMovieTimeFormat(seekBarMoviePlay.progress.toLong())}/${TimeUtils.getPlayMovieTimeFormat(seekBarMoviePlay.max.toLong())}"
+                                    }
+                                }
+                            }
+                        }, 0, 1)
+                    } else {
+                        isPause = false
+                    }
+                }
+
+                iv_shareDialog_pause.setOnClickListener {
+                    it.visibility = View.INVISIBLE
+                    iv_shareDialog_play.visibility = View.VISIBLE
+                    videoShareDialogPreview.pause()
+                    isPause = true
+                }
+
+                tv_shareDialog_time?.text = "${TimeUtils.getPlayMovieTimeFormat(seekBarMoviePlay.progress.toLong())}/${TimeUtils.getPlayMovieTimeFormat(seekBarMoviePlay.max.toLong())}"
+
+                seekBarMoviePlay.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+                    override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
+                        if (fromUser) {
+                            videoShareDialogPreview.seekTo(progress)
+                        }
+                    }
+
+                    override fun onStartTrackingTouch(seekBar: SeekBar?) {
+                    }
+
+                    override fun onStopTrackingTouch(seekBar: SeekBar?) {
+                    }
+                })
+            } catch (e: Exception) {
+                disableMovieView(this)
+            }
 
             sceneList.apply {
                 setHasFixedSize(true)
@@ -93,6 +138,29 @@ class ShareDialog : DialogFragment() {
         }
     }
 
+    private fun disableMovieView(view: View) {
+        view.apply {
+            videoShareDialogPreview?.apply {
+                isEnabled = false
+            }
+            seekBarMoviePlay?.apply {
+                isEnabled = false
+            }
+            iv_shareDialog_play?.apply {
+                isEnabled = false
+                setColorFilter(ContextCompat.getColor(context, android.R.color.darker_gray), PorterDuff.Mode.SRC_ATOP)
+            }
+            iv_shareDialog_bomo?.apply {
+                isEnabled = false
+                setColorFilter(ContextCompat.getColor(context, android.R.color.darker_gray), PorterDuff.Mode.SRC_ATOP)
+            }
+            iv_shareDialog_more?.apply {
+                isEnabled = false
+                setColorFilter(ContextCompat.getColor(context, android.R.color.darker_gray), PorterDuff.Mode.SRC_ATOP)
+            }
+        }
+    }
+
     fun show(manager: FragmentManager?) {
         manager?.apply {
             val ft = beginTransaction()
@@ -103,16 +171,6 @@ class ShareDialog : DialogFragment() {
         super.show(manager, dialogTag)
     }
 
-    override fun onDetach() {
-        super.onDetach()
-        dismissListener = null
-    }
-
-    override fun onDismiss(dialog: DialogInterface?) {
-        super.onDismiss(dialog)
-        dismissListener?.onDismiss(dialog)
-    }
-
     inner class MovieAdapter : RecyclerView.Adapter<MovieAdapter.ViewHolder>() {
         override fun onCreateViewHolder(p0: ViewGroup, p1: Int): ViewHolder {
             val view = LayoutInflater.from(p0.context).inflate(R.layout.scene_item_view, p0, false)

+ 35 - 15
src/main/res/layout/dialog_share.xml

@@ -53,6 +53,16 @@
         android:layout_height="280dp"
         android:layout_marginTop="24dp"
         android:background="@color/cocoa"
+        android:visibility="gone"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/view_shareDialog_header" />
+
+    <VideoView
+        android:id="@+id/videoShareDialogPreview"
+        android:layout_width="560dp"
+        android:layout_height="280dp"
+        android:layout_marginTop="24dp"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@id/view_shareDialog_header" />
@@ -71,8 +81,8 @@
         android:text="@string/share_dialog_edit_cover"
         app:layout_constraintBottom_toTopOf="@id/btn_shareDialog_exportPdf"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toLeftOf="@id/movieView_shareDialog_preview"
-        app:layout_constraintTop_toTopOf="@id/movieView_shareDialog_preview" />
+        app:layout_constraintRight_toLeftOf="@id/videoShareDialogPreview"
+        app:layout_constraintTop_toTopOf="@id/videoShareDialogPreview" />
 
     <Button
         android:id="@+id/btn_shareDialog_exportPdf"
@@ -88,7 +98,7 @@
         android:text="@string/share_dialog_export_pdf"
         app:layout_constraintBottom_toTopOf="@id/btn_shareDialog_print"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toLeftOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintRight_toLeftOf="@id/videoShareDialogPreview"
         app:layout_constraintTop_toBottomOf="@id/btn_shareDialog_editCover" />
 
     <TextView
@@ -104,7 +114,7 @@
         android:gravity="center"
         android:text="@string/share_dialog_print"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toLeftOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintRight_toLeftOf="@id/videoShareDialogPreview"
         app:layout_constraintTop_toBottomOf="@id/btn_shareDialog_exportPdf" />
 
     <ImageView
@@ -115,8 +125,8 @@
         android:layout_marginRight="36dp"
         android:background="?attr/selectableItemBackground"
         android:src="@drawable/ic_btn_bomo_01"
-        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
-        app:layout_constraintTop_toTopOf="@id/movieView_shareDialog_preview" />
+        app:layout_constraintLeft_toRightOf="@id/videoShareDialogPreview"
+        app:layout_constraintTop_toTopOf="@id/videoShareDialogPreview" />
 
     <ImageView
         android:id="@+id/iv_shareDialog_youtube"
@@ -128,7 +138,7 @@
         android:layout_marginTop="16dp"
         android:src="@drawable/ic_btn_youtube_01"
         android:tint="@android:color/darker_gray"
-        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintLeft_toRightOf="@id/videoShareDialogPreview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_bomo" />
 
     <ImageView
@@ -141,7 +151,7 @@
         android:layout_marginTop="16dp"
         android:src="@drawable/ic_btn_facebook_01"
         android:tint="@android:color/darker_gray"
-        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintLeft_toRightOf="@id/videoShareDialogPreview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_youtube" />
 
     <ImageView
@@ -154,7 +164,7 @@
         android:layout_marginTop="16dp"
         android:src="@drawable/ic_btn_twitter_01"
         android:tint="@android:color/darker_gray"
-        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintLeft_toRightOf="@id/videoShareDialogPreview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_facebook" />
 
     <ImageView
@@ -165,7 +175,7 @@
         android:layout_marginRight="36dp"
         android:layout_marginTop="16dp"
         android:src="@drawable/ic_btn_more_01"
-        app:layout_constraintLeft_toRightOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintLeft_toRightOf="@id/videoShareDialogPreview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_twitter" />
 
     <ImageView
@@ -174,8 +184,18 @@
         android:layout_height="48dp"
         android:layout_marginTop="8dp"
         android:src="@drawable/ic_play"
-        app:layout_constraintLeft_toLeftOf="@id/movieView_shareDialog_preview"
-        app:layout_constraintTop_toBottomOf="@id/movieView_shareDialog_preview" />
+        app:layout_constraintLeft_toLeftOf="@id/videoShareDialogPreview"
+        app:layout_constraintTop_toBottomOf="@id/videoShareDialogPreview" />
+
+    <ImageView
+        android:id="@+id/iv_shareDialog_pause"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:visibility="invisible"
+        android:layout_marginTop="8dp"
+        android:src="@drawable/ic_pause"
+        app:layout_constraintLeft_toLeftOf="@id/videoShareDialogPreview"
+        app:layout_constraintTop_toBottomOf="@id/videoShareDialogPreview"/>
 
     <TextView
         android:id="@+id/tv_shareDialog_time"
@@ -186,7 +206,7 @@
         android:textSize="16sp"
         android:textStyle="normal"
         app:layout_constraintBottom_toBottomOf="@id/iv_shareDialog_play"
-        app:layout_constraintRight_toRightOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintRight_toRightOf="@id/videoShareDialogPreview"
         app:layout_constraintTop_toTopOf="@id/iv_shareDialog_play"
         tools:text="0:20/3:00" />
 
@@ -212,8 +232,8 @@
         android:paddingEnd="4dp"
         android:paddingStart="4dp"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintLeft_toLeftOf="@id/movieView_shareDialog_preview"
-        app:layout_constraintRight_toRightOf="@id/movieView_shareDialog_preview"
+        app:layout_constraintLeft_toLeftOf="@id/videoShareDialogPreview"
+        app:layout_constraintRight_toRightOf="@id/videoShareDialogPreview"
         app:layout_constraintTop_toBottomOf="@id/iv_shareDialog_play" />
 
 </android.support.constraint.ConstraintLayout>