铸造同伴库变化的视频,无需重新启动活动? [英] Cast companion library change video without restarting activity?

查看:111
本文介绍了铸造同伴库变化的视频,无需重新启动活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了使用演员伴侣库(CCL)来远程播放视频施放同类器件的应用程序。每一件事情是努力的过程中,但我需要能够改变视频文件,而不是杀死并重新启动活动和片段。

I have built an application that uses Cast Companion Library (CCL) to remotely play video to cast comparable devices. Every thing is working find but I need to be able to change video files and not kill and restart the activity and fragment.

我已经实现,实现同一界面VideoCastControllerActivity我自己的定制版本,但我认为CCL自带的VideoCastControllerFragment重新使用。一个问题是,VideoCastControllerFragment并没有真正给出具体的通知到达视频文件的末尾时。它有点从IVideoCastController接口调用closeActivity(),所以我试图用这个事件来知道什么时候加载下一个视频文件一样。但是,通过调用加载下一个视频文件

I have implemented my own custom version of the VideoCastControllerActivity that implements the same interface but I am re-using the VideoCastControllerFragment that CCL comes with. One problem is that the VideoCastControllerFragment does not really give specific notice when the end of a video file is reached. It somewhat does by calling closeActivity() from the IVideoCastController interface so I tried to use that event to know when to load the next video file. But loading the next video file by calling

getCastManager().loadMedia( mSelectedMedia, autoPlay, position ); 

但这样做的结果在另一个调用,直到没有播放任何视频到达播放列表的末尾关闭活动和循环。

but doing that results in another call to close activity and a loop until the end of the playlist is reached without playing any video.

有另一种方式来进行此事,而无需重新编写自己的VideoCastControllerFragment?

Is there another way to go about this without re-writing my own VideoCastControllerFragment?

推荐答案

要回答你的第一个问题(或观察),你可以听你的执行VideoCastControllerActivity直接各项回调事件;您可以访问VideoCastManager让你知道当你的媒体状态去与成品原因处于闲置状态。以外的是,你似乎在试图实现在你发送某种播放列表功能,同时为正确的位置是在接收器(即你需要编写一个自定义接收器);如果您的播放列表的知识/逻辑住您的手机上,然后所以如果它进入睡眠状态,整个事情变得依赖您的手机上,您的Chromecast不知道该怎么办。此外,如果第二个设备连接到同一炉设备,它不能正确反映播放列表等,所以一个电话设备可以让用户形成一个播放列表,然后它有关于播放列表中的信息发送到您的自定义接收机和自接收器应该处理播放他们在队列中,发送方(S)应该能够发送自定义邮件移动到下一个/ $ p $光伏等和接收器应该相应地做正确的事。我们对我们的GitHub库一个非常基本的样品将告诉您如何在接收器上做视频的播放列表

To answer your first question (or observation), you can listen to various callback events directly in your implementation of VideoCastControllerActivity; you have access to the VideoCastManager so you know when your media status goes to IDLE with the reason FINISHED. Outside of that, you seem to be trying to implement some sort of playlist functionality in your sender while the right place for that is on the receiver (i.e. you need to write a custom receiver); if your playlist knowledge/logic lives on your phone, then the whole thing becomes dependent on your phone so if it goes to sleep, you chromecast doesn't know what to do. In addition, if a second device connects to the same cast device, it cannot correctly reflect the playlist, etc. So a phone device can let user form a playlist and then it has to send the information about that playlist to your custom receiver and your custom receiver should handle playing them in queue and your sender(s) should be able to send custom messages to move to the next/prev, etc and your receiver should do the right thing accordingly. We have a very rudimentary sample on our GitHub repo that shows how you can do video playlist on the receiver.

这篇关于铸造同伴库变化的视频,无需重新启动活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆