mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2026-05-16 13:02:39 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 418f34c7e8 | |||
| 21c2ab21b2 | |||
| 1ace7318f3 | |||
| 48052b88db | |||
| 715c60dc6e |
@@ -319,7 +319,11 @@ class UIDialogs {
|
||||
closeAction?.invoke()
|
||||
}, UIDialogs.ActionStyle.NONE),
|
||||
UIDialogs.Action(context.getString(R.string.retry), {
|
||||
retryAction?.invoke();
|
||||
try {
|
||||
retryAction?.invoke();
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Unhandled exception retrying", e)
|
||||
}
|
||||
}, UIDialogs.ActionStyle.PRIMARY)
|
||||
);
|
||||
else
|
||||
@@ -333,7 +337,11 @@ class UIDialogs {
|
||||
closeAction?.invoke()
|
||||
}, UIDialogs.ActionStyle.NONE),
|
||||
UIDialogs.Action(context.getString(R.string.retry), {
|
||||
retryAction?.invoke();
|
||||
try {
|
||||
retryAction?.invoke();
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Unhandled exception retrying", e)
|
||||
}
|
||||
}, UIDialogs.ActionStyle.PRIMARY)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ abstract class CastingDevice {
|
||||
|
||||
val expectedCurrentTime: Double
|
||||
get() {
|
||||
val diff = (System.currentTimeMillis() - lastTimeChangeTime_ms).toDouble() / 1000.0;
|
||||
val diff = if (isPlaying) ((System.currentTimeMillis() - lastTimeChangeTime_ms).toDouble() / 1000.0) else 0.0;
|
||||
return time + diff;
|
||||
};
|
||||
var connectionState: CastConnectionState = CastConnectionState.DISCONNECTED
|
||||
|
||||
@@ -344,6 +344,10 @@ class ChromecastCastingDevice : CastingDevice {
|
||||
|
||||
//Connection loop
|
||||
while (_scopeIO?.isActive == true) {
|
||||
_sessionId = null;
|
||||
_launchRetries = 0
|
||||
_mediaSessionId = null;
|
||||
|
||||
Logger.i(TAG, "Connecting to Chromecast.");
|
||||
connectionState = CastConnectionState.CONNECTING;
|
||||
|
||||
@@ -499,6 +503,10 @@ class ChromecastCastingDevice : CastingDevice {
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
Logger.w(TAG, "Failed to send channel message (sourceId: $sourceId, destinationId: $destinationId, namespace: $namespace, json: $json)", e);
|
||||
_socket?.close();
|
||||
Logger.i(TAG, "Socket disconnected.");
|
||||
|
||||
connectionState = CastConnectionState.CONNECTING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +608,7 @@ class ChromecastCastingDevice : CastingDevice {
|
||||
}
|
||||
|
||||
isPlaying = playerState == "PLAYING";
|
||||
if (isPlaying) {
|
||||
if (isPlaying || playerState == "PAUSED") {
|
||||
setTime(currentTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,11 @@ class TaskHandler<TParameter, TResult> {
|
||||
handled = true;
|
||||
} catch (e: Throwable) {
|
||||
Logger.w(TAG, "Handled exception in TaskHandler onSuccess.", e);
|
||||
onError.emit(e, parameter);
|
||||
try {
|
||||
onError.emit(e, parameter);
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Unhandled exception in .exception handler 1", e)
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
@@ -99,10 +103,14 @@ class TaskHandler<TParameter, TResult> {
|
||||
if (id != _idGenerator)
|
||||
return@withContext;
|
||||
|
||||
if (!onError.emit(e, parameter)) {
|
||||
Logger.e(TAG, "Uncaught exception handled by TaskHandler.", e);
|
||||
} else {
|
||||
//Logger.w(TAG, "Handled exception in TaskHandler invoke.", e); (Prevents duplicate logs)
|
||||
try {
|
||||
if (!onError.emit(e, parameter)) {
|
||||
Logger.e(TAG, "Uncaught exception handled by TaskHandler.", e);
|
||||
} else {
|
||||
//Logger.w(TAG, "Handled exception in TaskHandler invoke.", e); (Prevents duplicate logs)
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Unhandled exception in .exception handler 2", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -619,6 +619,7 @@ class VideoDetailView : ConstraintLayout {
|
||||
loadCurrentVideo(lastPositionMilliseconds);
|
||||
updatePillButtonVisibilities();
|
||||
setCastEnabled(false);
|
||||
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
@@ -647,6 +648,15 @@ class VideoDetailView : ConstraintLayout {
|
||||
_timeBar.setDuration(video?.duration ?: 0);
|
||||
}
|
||||
};
|
||||
|
||||
_cast.onTimeJobTimeChanged_s.subscribe {
|
||||
if (_isCasting) {
|
||||
setLastPositionMilliseconds((it * 1000.0).toLong(), true);
|
||||
_timeBar.setPosition(it);
|
||||
_timeBar.setBufferedPosition(0);
|
||||
_timeBar.setDuration(video?.duration ?: 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_playerProgress.player = _player.exoPlayer?.player;
|
||||
|
||||
@@ -10,10 +10,11 @@ class ItemMoveCallback : ItemTouchHelper.Callback {
|
||||
var onRowMoved = Event2<Int, Int>();
|
||||
var onRowSelected = Event1<ViewHolder>();
|
||||
var onRowClear = Event1<ViewHolder>();
|
||||
var canEdit = true
|
||||
|
||||
constructor() : super() { }
|
||||
|
||||
override fun isLongPressDragEnabled(): Boolean { return true; }
|
||||
override fun isLongPressDragEnabled(): Boolean { return canEdit; }
|
||||
override fun isItemViewSwipeEnabled(): Boolean { return false; }
|
||||
|
||||
override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {
|
||||
|
||||
@@ -21,10 +21,13 @@ import com.futo.platformplayer.R
|
||||
import com.futo.platformplayer.api.media.models.chapters.IChapter
|
||||
import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails
|
||||
import com.futo.platformplayer.casting.AirPlayCastingDevice
|
||||
import com.futo.platformplayer.casting.ChromecastCastingDevice
|
||||
import com.futo.platformplayer.casting.StateCasting
|
||||
import com.futo.platformplayer.constructs.Event0
|
||||
import com.futo.platformplayer.constructs.Event1
|
||||
import com.futo.platformplayer.constructs.Event2
|
||||
import com.futo.platformplayer.formatDuration
|
||||
import com.futo.platformplayer.states.StateHistory
|
||||
import com.futo.platformplayer.states.StatePlayer
|
||||
import com.futo.platformplayer.views.behavior.GestureControlView
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -61,6 +64,7 @@ class CastView : ConstraintLayout {
|
||||
val onSettingsClick = Event0();
|
||||
val onPrevious = Event0();
|
||||
val onNext = Event0();
|
||||
val onTimeJobTimeChanged_s = Event1<Long>()
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
@@ -185,11 +189,11 @@ class CastView : ConstraintLayout {
|
||||
}
|
||||
|
||||
fun setIsPlaying(isPlaying: Boolean) {
|
||||
_updateTimeJob?.cancel();
|
||||
stopTimeJob()
|
||||
|
||||
if(isPlaying) {
|
||||
val d = StateCasting.instance.activeDevice;
|
||||
if (d is AirPlayCastingDevice) {
|
||||
if (d is AirPlayCastingDevice || d is ChromecastCastingDevice) {
|
||||
_updateTimeJob = _scope.launch {
|
||||
while (true) {
|
||||
val device = StateCasting.instance.activeDevice;
|
||||
@@ -198,7 +202,9 @@ class CastView : ConstraintLayout {
|
||||
}
|
||||
|
||||
delay(1000);
|
||||
setTime((device.expectedCurrentTime * 1000.0).toLong());
|
||||
val time_ms = (device.expectedCurrentTime * 1000.0).toLong()
|
||||
setTime(time_ms);
|
||||
onTimeJobTimeChanged_s.emit(device.expectedCurrentTime.toLong())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ class VideoListEditorView : FrameLayout {
|
||||
val onVideoOptions = Event1<IPlatformVideo>();
|
||||
val onVideoClicked = Event1<IPlatformVideo>();
|
||||
val isEmpty get() = _videos.isEmpty();
|
||||
val itemMoveCallback: ItemMoveCallback
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet? = null) : super(context, attrs) {
|
||||
val recyclerPlaylist = RecyclerView(context, attrs);
|
||||
@@ -34,14 +35,14 @@ class VideoListEditorView : FrameLayout {
|
||||
recyclerPlaylist.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
|
||||
addView(recyclerPlaylist);
|
||||
|
||||
val callback = ItemMoveCallback();
|
||||
val touchHelper = ItemTouchHelper(callback);
|
||||
itemMoveCallback = ItemMoveCallback();
|
||||
val touchHelper = ItemTouchHelper(itemMoveCallback);
|
||||
val adapterVideos = VideoListEditorAdapter(touchHelper);
|
||||
recyclerPlaylist.adapter = adapterVideos;
|
||||
recyclerPlaylist.layoutManager = LinearLayoutManager(context);
|
||||
touchHelper.attachToRecyclerView(recyclerPlaylist);
|
||||
|
||||
callback.onRowMoved.subscribe { fromPosition, toPosition ->
|
||||
itemMoveCallback.onRowMoved.subscribe { fromPosition, toPosition ->
|
||||
synchronized(_videos) {
|
||||
if (fromPosition < toPosition) {
|
||||
for (i in fromPosition until toPosition)
|
||||
@@ -94,6 +95,7 @@ class VideoListEditorView : FrameLayout {
|
||||
synchronized(_videos) {
|
||||
_videos.clear();
|
||||
_videos.addAll(videos ?: listOf());
|
||||
itemMoveCallback.canEdit = canEdit
|
||||
_adapterVideos?.setVideos(_videos, canEdit);
|
||||
}
|
||||
}
|
||||
|
||||
Submodule app/src/stable/assets/sources/dailymotion updated: ffd40f2006...d115430011
Submodule app/src/stable/assets/sources/odysee updated: 215cd9bd70...6ea9fa7e4c
Submodule app/src/stable/assets/sources/patreon updated: e5dce87c9d...d98c7f8aee
Submodule app/src/stable/assets/sources/peertube updated: 6e7f943b0b...56bff39123
Submodule app/src/stable/assets/sources/rumble updated: 932fdf78de...3bbce81794
Submodule app/src/stable/assets/sources/soundcloud updated: f8234d6af8...5456431268
Submodule app/src/stable/assets/sources/spotify updated: 47e76a96e5...1d884f50ab
Submodule app/src/stable/assets/sources/youtube updated: a297a0a788...6d6838e2a4
Submodule app/src/unstable/assets/sources/apple-podcasts updated: 9aa31c5e87...089987f007
Submodule app/src/unstable/assets/sources/bitchute updated: b31ced36b9...b213f91c0b
Submodule app/src/unstable/assets/sources/dailymotion updated: ffd40f2006...d115430011
Submodule app/src/unstable/assets/sources/odysee updated: 215cd9bd70...6ea9fa7e4c
Submodule app/src/unstable/assets/sources/patreon updated: e5dce87c9d...d98c7f8aee
Submodule app/src/unstable/assets/sources/peertube updated: 6e7f943b0b...56bff39123
Submodule app/src/unstable/assets/sources/rumble updated: 932fdf78de...3bbce81794
Submodule app/src/unstable/assets/sources/soundcloud updated: f8234d6af8...5456431268
Submodule app/src/unstable/assets/sources/spotify updated: 47e76a96e5...1d884f50ab
Submodule app/src/unstable/assets/sources/youtube updated: a297a0a788...6d6838e2a4
Reference in New Issue
Block a user