diff --git a/app/build.gradle b/app/build.gradle index 974a0412a..21cd69f15 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId 'com.github.libretube' - minSdk 24 + minSdk 21 targetSdk 31 versionCode 4 versionName '0.2.2' @@ -62,5 +62,5 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.1' implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' - implementation 'com.arthenica:ffmpeg-kit-full:4.5.1' + implementation 'com.arthenica:ffmpeg-kit-https:4.5.1.LTS' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f27bc0190..4e8448cbe 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,7 +4,8 @@ - + + = Build.VERSION_CODES.R) { + Log.d("myz", "" + SDK_INT) + if (!Environment.isExternalStorageManager()) { + ActivityCompat.requestPermissions( + mainActivity, arrayOf( + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.MANAGE_EXTERNAL_STORAGE + ), 1 + ) //permission request code is just an int + } + } else { + if (ActivityCompat.checkSelfPermission( + requireContext(), + Manifest.permission.READ_EXTERNAL_STORAGE + ) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission( + requireContext(), + Manifest.permission.WRITE_EXTERNAL_STORAGE + ) != PackageManager.PERMISSION_GRANTED + ) { + ActivityCompat.requestPermissions( + mainActivity, + arrayOf( + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE + ), + 1 + ) + } + } + FFmpegKit.executeAsync("-i ${response.videoStreams[0].url} -i ${response.audioStreams!![0].url} -c copy ${context?.getExternalFilesDir(DIRECTORY_DOWNLOADS)}${File.separator}output1.mkv", { session -> val state = session.state val returnCode = session.returnCode @@ -376,6 +413,7 @@ class PlayerFragment : Fragment() { ) }, { // CALLED WHEN SESSION PRINTS LOGS + Log.e(TAG,it.toString()) }) { // CALLED WHEN SESSION GENERATES STATISTICS }