mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
.
This commit is contained in:
parent
bd77249443
commit
181c6f49c6
@ -8,7 +8,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId 'com.github.libretube'
|
applicationId 'com.github.libretube'
|
||||||
minSdk 21
|
minSdk 24
|
||||||
targetSdk 31
|
targetSdk 31
|
||||||
versionCode 4
|
versionCode 4
|
||||||
versionName '0.2.2'
|
versionName '0.2.2'
|
||||||
@ -61,4 +61,6 @@ dependencies {
|
|||||||
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
|
||||||
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.1'
|
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.1'
|
||||||
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
|
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
|
||||||
|
|
||||||
|
implementation 'com.arthenica:ffmpeg-kit-full:4.5.1'
|
||||||
}
|
}
|
@ -35,6 +35,8 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -1,58 +1,49 @@
|
|||||||
package com.github.libretube
|
package com.github.libretube
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.os.Bundle
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.google.android.exoplayer2.ExoPlayer
|
|
||||||
import com.google.android.exoplayer2.MediaItem
|
|
||||||
import com.google.android.exoplayer2.MediaItem.SubtitleConfiguration
|
|
||||||
import com.google.android.exoplayer2.source.MediaSource
|
|
||||||
|
|
||||||
import com.google.android.exoplayer2.ui.StyledPlayerView
|
|
||||||
|
|
||||||
import java.io.IOException
|
|
||||||
import kotlin.math.abs
|
|
||||||
import com.google.android.exoplayer2.util.MimeTypes
|
|
||||||
import com.google.common.collect.ImmutableList
|
|
||||||
import android.app.ActionBar
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.widget.*
|
|
||||||
import androidx.core.net.toUri
|
|
||||||
import com.google.android.exoplayer2.MediaItem.fromUri
|
|
||||||
import com.google.android.exoplayer2.source.MergingMediaSource
|
|
||||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource
|
|
||||||
import com.google.android.exoplayer2.upstream.DataSource
|
|
||||||
|
|
||||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
|
|
||||||
import android.widget.TextView
|
|
||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.os.Bundle
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.*
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.core.net.toUri
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.exoplayer2.Player
|
import com.arthenica.ffmpegkit.FFmpegKit
|
||||||
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
|
|
||||||
|
|
||||||
import com.squareup.picasso.Picasso
|
|
||||||
import retrofit2.HttpException
|
|
||||||
import com.github.libretube.adapters.TrendingAdapter
|
import com.github.libretube.adapters.TrendingAdapter
|
||||||
import com.github.libretube.obj.PipedStream
|
import com.github.libretube.obj.PipedStream
|
||||||
import com.github.libretube.obj.Subscribe
|
import com.github.libretube.obj.Subscribe
|
||||||
|
import com.google.android.exoplayer2.ExoPlayer
|
||||||
|
import com.google.android.exoplayer2.MediaItem
|
||||||
|
import com.google.android.exoplayer2.MediaItem.SubtitleConfiguration
|
||||||
|
import com.google.android.exoplayer2.MediaItem.fromUri
|
||||||
|
import com.google.android.exoplayer2.Player
|
||||||
|
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
|
||||||
|
import com.google.android.exoplayer2.source.MediaSource
|
||||||
|
import com.google.android.exoplayer2.source.MergingMediaSource
|
||||||
|
import com.google.android.exoplayer2.source.ProgressiveMediaSource
|
||||||
|
import com.google.android.exoplayer2.ui.StyledPlayerView
|
||||||
|
import com.google.android.exoplayer2.upstream.DataSource
|
||||||
|
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
|
import com.squareup.picasso.Picasso
|
||||||
|
import retrofit2.HttpException
|
||||||
|
import java.io.IOException
|
||||||
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
|
||||||
var isFullScreen = false
|
var isFullScreen = false
|
||||||
@ -75,6 +66,8 @@ class PlayerFragment : Fragment() {
|
|||||||
private lateinit var exoPlayer: ExoPlayer
|
private lateinit var exoPlayer: ExoPlayer
|
||||||
private lateinit var mediaSource: MediaSource
|
private lateinit var mediaSource: MediaSource
|
||||||
|
|
||||||
|
private lateinit var relDownloadVideo: RelativeLayout
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
arguments?.let {
|
arguments?.let {
|
||||||
@ -92,6 +85,7 @@ class PlayerFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
relDownloadVideo = view.findViewById(R.id.relPlayer_download)
|
||||||
val mainActivity = activity as MainActivity
|
val mainActivity = activity as MainActivity
|
||||||
mainActivity.findViewById<FrameLayout>(R.id.container).visibility=View.VISIBLE
|
mainActivity.findViewById<FrameLayout>(R.id.container).visibility=View.VISIBLE
|
||||||
val playerMotionLayout = view.findViewById<MotionLayout>(R.id.playerMotionLayout)
|
val playerMotionLayout = view.findViewById<MotionLayout>(R.id.playerMotionLayout)
|
||||||
@ -363,6 +357,30 @@ class PlayerFragment : Fragment() {
|
|||||||
val subButton = view.findViewById<MaterialButton>(R.id.player_subscribe)
|
val subButton = view.findViewById<MaterialButton>(R.id.player_subscribe)
|
||||||
isSubscribed(subButton, channelId!!)
|
isSubscribed(subButton, channelId!!)
|
||||||
}
|
}
|
||||||
|
relDownloadVideo.setOnClickListener {
|
||||||
|
Log.e(TAG,"download button clicked!")
|
||||||
|
FFmpegKit.executeAsync("-i ${response.videoStreams[0].url} -i ${response.audioStreams!![0].url} -c copy output.mkv",
|
||||||
|
{ session ->
|
||||||
|
val state = session.state
|
||||||
|
val returnCode = session.returnCode
|
||||||
|
|
||||||
|
// CALLED WHEN SESSION IS EXECUTED
|
||||||
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
String.format(
|
||||||
|
"FFmpeg process exited with state %s and rc %s.%s",
|
||||||
|
state,
|
||||||
|
returnCode,
|
||||||
|
session.failStackTrace
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}, {
|
||||||
|
// CALLED WHEN SESSION PRINTS LOGS
|
||||||
|
}) {
|
||||||
|
// CALLED WHEN SESSION GENERATES STATISTICS
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,6 +389,8 @@ class PlayerFragment : Fragment() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun isSubscribed(button: MaterialButton, channel_id: String){
|
private fun isSubscribed(button: MaterialButton, channel_id: String){
|
||||||
@SuppressLint("ResourceAsColor")
|
@SuppressLint("ResourceAsColor")
|
||||||
fun run() {
|
fun run() {
|
||||||
|
@ -24,7 +24,7 @@ class Settings : PreferenceFragmentCompat() {
|
|||||||
setPreferencesFromResource(R.xml.settings, rootKey)
|
setPreferencesFromResource(R.xml.settings, rootKey)
|
||||||
val instance = findPreference<ListPreference>("instance")
|
val instance = findPreference<ListPreference>("instance")
|
||||||
fetchInstance()
|
fetchInstance()
|
||||||
instance?.setOnPreferenceChangeListener { preference, newValue ->
|
instance?.setOnPreferenceChangeListener { _, newValue ->
|
||||||
RetrofitInstance.url = newValue.toString()
|
RetrofitInstance.url = newValue.toString()
|
||||||
RetrofitInstance.lazyMgr.reset()
|
RetrofitInstance.lazyMgr.reset()
|
||||||
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
val sharedPref = context?.getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||||
@ -62,7 +62,6 @@ class Settings : PreferenceFragmentCompat() {
|
|||||||
Log.e("settings",e.toString())
|
Log.e("settings",e.toString())
|
||||||
return@launchWhenCreated
|
return@launchWhenCreated
|
||||||
}
|
}
|
||||||
//println("dafaq $response")
|
|
||||||
val listEntries: MutableList<String> = ArrayList()
|
val listEntries: MutableList<String> = ArrayList()
|
||||||
val listEntryValues: MutableList<String> = ArrayList()
|
val listEntryValues: MutableList<String> = ArrayList()
|
||||||
for(item in response){
|
for(item in response){
|
||||||
|
@ -101,6 +101,7 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:id="@+id/relPlayer_download"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user