#123 - some tests

This commit is contained in:
Thomas 2020-12-05 14:01:08 +01:00
parent 413792087e
commit 35c5713b0a
1 changed files with 11 additions and 9 deletions

View File

@ -161,6 +161,7 @@ import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.RATE
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY; import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY;
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT; import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT;
import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_VIDEO; import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPORT_VIDEO;
import static app.fedilab.fedilabtube.helper.Helper.CAST_ID;
import static app.fedilab.fedilabtube.helper.Helper.getAttColor; import static app.fedilab.fedilabtube.helper.Helper.getAttColor;
import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn; import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
import static app.fedilab.fedilabtube.helper.Helper.loadGiF; import static app.fedilab.fedilabtube.helper.Helper.loadGiF;
@ -724,10 +725,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
Status status = chromeCast.getStatus(); Status status = chromeCast.getStatus();
String app_id = status.getRunningApp().id;
Application app = null; Application app = null;
if (chromeCast.isAppAvailable(app_id) && !status.isAppRunning(app_id)) { if (chromeCast.isAppAvailable(CAST_ID) && !status.isAppRunning(CAST_ID)) {
chromeCast.launchApp(app_id); chromeCast.launchApp(CAST_ID);
} }
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
@ -736,7 +736,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
dialog.dismiss(); dialog.dismiss();
}; };
mainHandler.post(myRunnable); mainHandler.post(myRunnable);
if (status.isAppRunning(app_id) && chromeCastVideoURL != null) { if (status.isAppRunning(CAST_ID) && chromeCastVideoURL != null) {
app = status.getRunningApp(); app = status.getRunningApp();
chromeCast.load(peertube.getTitle(), "https://" + HelperInstance.getLiveInstance(PeertubeActivity.this) + peertube.getThumbnailPath(), chromeCastVideoURL, null); chromeCast.load(peertube.getTitle(), "https://" + HelperInstance.getLiveInstance(PeertubeActivity.this) + peertube.getThumbnailPath(), chromeCastVideoURL, null);
//chromeCast.send( app.namespaces.get(app.namespaces.size()-1).name, new DashCastRequest(chromeCastVideoURL, true, false, 0)); //chromeCast.send( app.namespaces.get(app.namespaces.size()-1).name, new DashCastRequest(chromeCastVideoURL, true, false, 0));
@ -1342,11 +1342,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
torrentStream.stopStream(); torrentStream.stopStream();
} }
if (chromeCast != null) { if (chromeCast != null) {
try { new Thread(() -> {
chromeCast.disconnect(); try {
} catch (IOException e) { chromeCast.disconnect();
e.printStackTrace(); } catch (IOException e) {
} e.printStackTrace();
}
}).start();
} }
unregisterReceiver(); unregisterReceiver();
} }