@ -1,8 +1,8 @@
package com.yinuo.safetywatcher.watcher.ui
package com.yinuo.safetywatcher.watcher.ui
import android.content.Intent
import android.content.Intent
import android.net.Uri
import android.view.View
import android.view.View
import androidx.core.content.FileProvider
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityHistoryVideoBinding
import com.yinuo.safetywatcher.databinding.ActivityHistoryVideoBinding
import com.yinuo.safetywatcher.player.ProVideoActivity
import com.yinuo.safetywatcher.player.ProVideoActivity
@ -20,16 +20,17 @@ class HistoryVideoActivity : BaseActivity() {
override fun onOptionClick ( type : Int , target : View ) {
override fun onOptionClick ( type : Int , target : View ) {
if ( 0 == type ) {
if ( 0 == type ) {
// val intent = Intent(Intent.ACTION_VIEW)
val intent = Intent ( Intent . ACTION _VIEW )
// val path = PathUtils.getExternalStorageDirectory() + "/test2.mp4" //该路径可以自定义
val path = PathUtils . getExternalStorageDirectory ( ) + " /test2.mp4 " //该路径可以自定义
// val file = File(path)
val file = File ( path )
// val uri = Uri.fromFile(file)
val uri =
// intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
FileProvider . getUriForFile ( this @HistoryVideoActivity , " com.yinuo.safetywatcher.fileprovider " , file )
// intent.setDataAndType(uri, "video/*")
intent . addFlags ( Intent . FLAG _ACTIVITY _NEW _TASK or Intent . FLAG _GRANT _READ _URI _PERMISSION or Intent . FLAG _GRANT _WRITE _URI _PERMISSION )
// startActivity(intent)
intent . setDataAndType ( uri , " video/* " )
startActivity ( intent )
} else if ( 1 == type ) {
} else if ( 1 == type ) {
val intent = Intent ( this @HistoryVideoActivity , ProVideoActivity :: class . java )
val intent = Intent ( this @HistoryVideoActivity , ProVideoActivity :: class . java )
val path = PathUtils . getExternalStorageDirectory ( ) + " /test .mp4"
val path = PathUtils . getExternalStorageDirectory ( ) + " /test 2 .mp4"
intent . putExtra ( " videoPath " , path )
intent . putExtra ( " videoPath " , path )
startActivity ( intent )
startActivity ( intent )
}
}