Add cast support #123 - try

This commit is contained in:
Thomas 2020-12-02 18:37:54 +01:00
parent 5757a8b1d8
commit 21c53d2b4d
1 changed files with 6 additions and 4 deletions

View File

@ -136,7 +136,6 @@ import app.fedilab.fedilabtube.drawer.CommentListAdapter;
import app.fedilab.fedilabtube.drawer.MenuAdapter;
import app.fedilab.fedilabtube.drawer.MenuItemAdapter;
import app.fedilab.fedilabtube.helper.CacheDataSourceFactory;
import app.fedilab.fedilabtube.helper.DashCastRequest;
import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.sqlite.AccountDAO;
@ -736,8 +735,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
Status status = chromeCast.getStatus();
String app_id = status.getRunningApp().id;
Application app = null;
if (chromeCast.isAppAvailable(app_id) && !status.isAppRunning(app_id)) {
Application app = chromeCast.launchApp(app_id);
chromeCast.launchApp(app_id);
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
@ -745,9 +746,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
dialog.dismiss();
};
mainHandler.post(myRunnable);
if (chromeCastVideoURL != null) {
if (status.isAppRunning(app_id) && chromeCastVideoURL != null) {
app = status.getRunningApp();
chromeCast.load(peertube.getTitle(), "https://" + HelperInstance.getLiveInstance(PeertubeActivity.this) + peertube.getThumbnailPath(), chromeCastVideoURL, null);
// chromeCast.send("urn:x-cast:es.offd.dashcast", new DashCastRequest(chromeCastVideoURL, true, false, 0));
//chromeCast.send( app.namespaces.get(app.namespaces.size()-1).name, new DashCastRequest(chromeCastVideoURL, true, false, 0));
}
} catch (IOException | GeneralSecurityException e) {