mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-07 15:28:40 +01:00
Fixed VideoPlayer using wrong context
This commit is contained in:
parent
031c969730
commit
fa5df96ee3
@ -104,7 +104,7 @@ public class BookmarksFragment extends Fragment {
|
||||
{
|
||||
if (entry.isVideo())
|
||||
{
|
||||
videoPlayer.getValue().playVideo(entry);
|
||||
videoPlayer.getValue().playVideo(getContext(), entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ public class SearchFragment extends Fragment {
|
||||
|
||||
private void onVideoSelected(MusicDirectory.Entry entry)
|
||||
{
|
||||
videoPlayer.getValue().playVideo(entry);
|
||||
videoPlayer.getValue().playVideo(getContext(), entry);
|
||||
}
|
||||
|
||||
private void autoplay()
|
||||
|
@ -85,6 +85,6 @@ val musicServiceModule = module {
|
||||
|
||||
single { DownloadHandler(get(), get()) }
|
||||
single { NetworkAndStorageChecker(androidContext()) }
|
||||
single { VideoPlayer(androidContext()) }
|
||||
single { VideoPlayer() }
|
||||
single { ShareHandler(androidContext()) }
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ class SelectAlbumFragment : Fragment() {
|
||||
bundle
|
||||
)
|
||||
} else if (entry != null && entry.isVideo) {
|
||||
videoPlayer.playVideo(entry)
|
||||
videoPlayer.playVideo(requireContext(), entry)
|
||||
} else {
|
||||
enableButtons()
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ open class RESTMusicService(
|
||||
"Get-Video-Url"
|
||||
).start()
|
||||
|
||||
latch.await(3, TimeUnit.SECONDS)
|
||||
latch.await(5, TimeUnit.SECONDS)
|
||||
|
||||
return expectedResult[0]!!
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ import org.moire.ultrasonic.util.Util
|
||||
/**
|
||||
* This utility class helps starting video playback
|
||||
*/
|
||||
class VideoPlayer(val context: Context) {
|
||||
fun playVideo(entry: MusicDirectory.Entry?) {
|
||||
class VideoPlayer() {
|
||||
fun playVideo(context: Context, entry: MusicDirectory.Entry?) {
|
||||
if (!Util.isNetworkConnected(context)) {
|
||||
Util.toast(context, R.string.select_album_no_network)
|
||||
return
|
||||
@ -18,7 +18,7 @@ class VideoPlayer(val context: Context) {
|
||||
try {
|
||||
player.playVideo(context, entry)
|
||||
} catch (e: Exception) {
|
||||
Util.toast(context, e.message, false)
|
||||
Util.toast(context, e.toString(), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user