2021-02-04 20:15:58 +01:00
|
|
|
package org.moire.ultrasonic.subsonic
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import org.moire.ultrasonic.R
|
|
|
|
import org.moire.ultrasonic.domain.MusicDirectory
|
|
|
|
import org.moire.ultrasonic.util.Util
|
|
|
|
|
2021-03-01 17:24:25 +01:00
|
|
|
/**
|
|
|
|
* This utility class helps starting video playback
|
|
|
|
*/
|
2021-03-27 20:14:56 +01:00
|
|
|
class VideoPlayer() {
|
|
|
|
fun playVideo(context: Context, entry: MusicDirectory.Entry?) {
|
2021-05-21 23:03:42 +02:00
|
|
|
if (!Util.isNetworkConnected()) {
|
2021-02-04 20:15:58 +01:00
|
|
|
Util.toast(context, R.string.select_album_no_network)
|
|
|
|
return
|
|
|
|
}
|
2021-05-09 08:35:15 +02:00
|
|
|
val player = Util.getVideoPlayerType()
|
2021-02-04 20:15:58 +01:00
|
|
|
try {
|
|
|
|
player.playVideo(context, entry)
|
|
|
|
} catch (e: Exception) {
|
2021-03-27 20:14:56 +01:00
|
|
|
Util.toast(context, e.toString(), false)
|
2021-02-04 20:15:58 +01:00
|
|
|
}
|
|
|
|
}
|
2021-02-14 15:55:16 +01:00
|
|
|
}
|