package com.adealink.weparty.commonui.mediapicker.videoselect.preview

import android.app.Activity
import android.content.Intent
import android.net.Uri
import com.adealink.frame.util.AppUtil
import com.adealink.frame.util.FileProvider7
import java.io.File


fun goVideoPreview(activity: Activity, path: String) {
    val uri = FileProvider7.getUriForFile(AppUtil.appContext, File(path)) ?: return
    goVideoPreview(activity, uri)
}

fun goVideoPreview(activity: Activity, uri: Uri) {
    val intent = Intent(Intent.ACTION_VIEW)
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
    intent.setDataAndType(uri, "video/*")
    activity.startActivity(intent)
}