MythTV-Clients / MythtvPlayerForAndroid

MythTV Player is an Android client for accessing content from a MythTV Backend
https://play.google.com/store/apps/details?id=org.mythtv.android
GNU General Public License v3.0
16 stars 7 forks source link

Implement Google Cast Support #106

Closed dmfrey closed 7 years ago

dmfrey commented 8 years ago

Work Branch: https://github.com/MythTV-Clients/MythtvPlayerForAndroid/tree/feature/issue_106_implement_google_cast

netwolfuk commented 8 years ago

I presume you are referring to being able to control a ChromeCast from MPFA?

What sort of receiver did you envisage needing to build? Looking this this video, there are three types. The StyledReceiver seems like the best fit to me, but the CustomReceiver gets special mention with regards to HLS.

I don't know anything about HLS other than I see a button for it inside the Player, so am not sure if it's really a requirement.

From watching that video, I have been able to glean that for the Styled and Custom receivers, the ChromeCast looks up the ID presented by the controller app by using in a Google service. This service redirects the ChromeCast to an HTML5 page containing the receiver implemenation. I initially thought this could be hosted in MythWeb locally on the MythTV server, but since it's google returning the URL, it would need to be on the internet somewhere. It could probably be served from github.io in the short-term. I'm not sure what GitHub's policy is on that sort of thing.

I'd be happy to help out if I can, and can test a ChromeCast (v1) and an Oppo BluRay player which supports the Cast version of the DIAL protocol.

Have you had a look at the NetFlix ChromeCast support? That seems to be the slickest Cast app I've seen. Also the RedBullTV one is good.

dmfrey commented 8 years ago

@netwolfuk Yes, the goal is to be able to present MythTV backend recordings and videos on Chromecast. I have committed what I have so far. You can select a local Chromecast device and disconnect from it at this point. Still no playback as of yet.

This should work with HLS transcoded recordings, mp4 and MKV files, according to the Supported Media Playback options.

I already have a Styled Media Receiver setup. It is not published at this time. You can send me the serial numbers for your devices and I can add you to the list so that you can test.

I believe a long term solution would be to have a custom receiver hosted on mythtv.org, if the devs are up for that. The styled one works for now.

netwolfuk commented 8 years ago

Cool! You're further ahead than I thought already. I'll dig out the serial numbers when I get a chance to sit down at the computer.

I see your latest commit has broken the build on my build server. What do I need to do to install Google play services cast support?

dmfrey commented 8 years ago

You should just need to update the Gradle dependencies. Can you post a stack trace?

On Sat, Mar 26, 2016, 12:00 AM netwolfuk notifications@github.com wrote:

Cool! You're further ahead than I thought already. I'll dig out the serial numbers when I get a chance to sit down at the computer.

I see your latest commit has broken the build on my build server. What do I need to do to install Google play services cast support?

— You are receiving this because you were assigned. Reply to this email directly or view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/106#issuecomment-201701825

netwolfuk commented 8 years ago

Sorry. I'm a numpty. Google Repository was not installed on the build agent. Build is succeeding now.

netwolfuk commented 8 years ago

I can't figure out how to get the Chromecast developer page to see my BluRay player, so I only have the genuine Chromecast one for now: 3819101ZJJL5

netwolfuk commented 8 years ago

FYI, I have built your branch and installed it on my Nexus 4. I can't see a way to navigate to the AppCastPlayerActivity though. It does not appear in the menu on the left, or up by the seach icon. I'll assume my Chromecast must be registered against your AppID for it to be available.

dmfrey commented 8 years ago

I need to add you serial number to my Google cast dev console. I will take care of that in a few. Once I do, I will let you know. Then you have to restart your Chromecast. It may take a few hours before it will see that it can be used as a developer device. This is Google's docs that describe this.

The AppCastPlayerActivity is going to get called from the recording or video details screens, only when you are connected to a cast device, otherwise, the other play options will be called. I haven't quite figured out how I want to do that part yet. It still needs to be refractored to make it generic for videos or recordings.

On Sat, Mar 26, 2016, 7:35 AM netwolfuk notifications@github.com wrote:

FYI, I have build your branch and installed it on my Nexus 4. I can't see a way to navigate to the AppCastPlayerActivity though. It does not appear in the menu on the left, or up by the seach icon. I'll assume my Chromecast must be registered against your AppID for it to be available.

— You are receiving this because you were assigned. Reply to this email directly or view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/106#issuecomment-201775963

dmfrey commented 8 years ago

@netwolfuk Your Chromecast has been added to the dev console. Reboot it. I will check back in a bit to see that it accepted the registration. From my end it will say 'Ready for Testing' on the console.

dmfrey commented 8 years ago

@netwolfuk shoot me an email address and I can add you to the slack channel

On Sat, Mar 26, 2016, 7:52 AM Daniel Frey dmfrey@gmail.com wrote:

I need to add you serial number to my Google cast dev console. I will take care of that in a few. Once I do, I will let you know. Then you have to restart your Chromecast. It may take a few hours before it will see that it can be used as a developer device. This is Google's docs that describe this.

The AppCastPlayerActivity is going to get called from the recording or video details screens, only when you are connected to a cast device, otherwise, the other play options will be called. I haven't quite figured out how I want to do that part yet. It still needs to be refractored to make it generic for videos or recordings.

On Sat, Mar 26, 2016, 7:35 AM netwolfuk notifications@github.com wrote:

FYI, I have build your branch and installed it on my Nexus 4. I can't see a way to navigate to the AppCastPlayerActivity though. It does not appear in the menu on the left, or up by the seach icon. I'll assume my Chromecast must be registered against your AppID for it to be available.

— You are receiving this because you were assigned. Reply to this email directly or view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/106#issuecomment-201775963

netwolfuk commented 8 years ago

Yey. The icon has appeared. My Chromecast must've registered. Thanks!

dmfrey commented 8 years ago

Yup, ready for testing. :-)

dmfrey commented 8 years ago

@billmeek @netwolfuk

In order for this to work successfully, we will need to configure the backend to produce CORS Headers. Also, it is helpful for the backend to produce Content-Type, Accept-Encoding and Range Headers. How do we best go about getting Port 6544 to produce these. Content-Type is already there, but the others are not. We can add these in a .htaccess file, but this would need to be a more permanent solution when installing mythtv backend.

Thoughts??

billmeek commented 8 years ago

@dmfrey I'll look into Access-Control-Allow-Origin: header, now that I did some reading about it. What value would it return? Assuming that * is too open and that in many cases, no domain name will be available, only an IP?

billmeek commented 8 years ago

And then I caught up on my IRC reading...

dmfrey commented 8 years ago

we will still need to add those headers. Just not sure what to set for the Range header. Content-type is already there.

On Thu, May 19, 2016 at 6:43 PM billmeek notifications@github.com wrote:

And then I caught up on my IRC reading...

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/106#issuecomment-220466635

dmfrey commented 8 years ago

SUCCESS!!! This works from the app, but only with an MP4 file, no extra headers required. Now the for the other streaming formats, we will need the other headers to get them to work.

dmfrey commented 8 years ago

closes #106

trainerbill commented 7 years ago

@dmfrey can you explain how to get this functionality? I am not seeing a chrome cast button on the mythplayer app.

dmfrey commented 7 years ago

Here are a couple of things to check.

  1. On the correct wifi network?
  2. Are you running the latest beta?

When you are connected to the network, the Google Cast button should just appear in the Action Bar. You then have to HLS transcode some recordings and/or videos. Unfortunately, Google Cast doesn't MPEG2-TS, so you either need an MP4 or HLS transcoding of the recording. Most video formats should just work, however, you can always transcode them to HLS.

Let me know how it goes.

Dan

On Wed, Oct 5, 2016 at 4:30 PM Andrew Throener notifications@github.com wrote:

@dmfrey https://github.com/dmfrey can you explain how to get this functionality? I am not seeing a chrome cast button on the mythplayer app.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/106#issuecomment-251790402, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5yzOEKhVYJQBsUtcieP67CkQ8ESBKuks5qxAjwgaJpZM4H3Vpa .

trainerbill commented 7 years ago

@dmfrey Thanks for the quick reply!

I am on 2.1.1, assuming i have to download the apk of the latest and install? Chromecast not supporting MPEG2 is a real bummer.

  1. How do the videos look using HLS?
  2. Can/does the app automatically start the HLS transcode when you start playing? Or do you have to go to the mythbackend to start the HLS transcode?
dmfrey commented 7 years ago

Go to the G+ page and follow the instructions to join the beta.

The videos look fine so long as they are in a format Chromecast supports. There is a page on the cast developer page that lists this. There are some that just won't work as is.

Mpeg2 just doesn't have hardware coding support.

On Wed, Oct 5, 2016, 4:55 PM Andrew Throener notifications@github.com wrote:

@dmfrey https://github.com/dmfrey Thanks for the quick reply!

I am on 2.1.1, assuming i have to download the apk of the latest and install? Chromecast not supporting MPEG2 is a real bummer.

  1. How do the videos look using HLS?
  2. Can/does the app automatically start the HLS transcode when you start playing? Or do you have to go to the mythbackend to start the HLS transcode?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/106#issuecomment-251796652, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5yzE_ItLtfQGgQcnhgA1-WABwvQvsIks5qxA6mgaJpZM4H3Vpa .

trainerbill commented 7 years ago

@dmfrey I have the beta and see the cast button now. I create an HLS stream and cast and it looks like it is going to load and then just displays the MythPlayer blue screen on the TV. I see the HLS stream on the Mythbackend and I can play the recording on my phone in the Mythplayer app, but casting doesn't work. Let me know if you want me to submit a new issue and any other info you need.

dmfrey commented 7 years ago

@trainerbill Did you get by this?

Here is one thing to try. Google Cast can be debugged through Chrome. Follow these instructions. https://developers.google.com/cast/docs/debugging

Let me know if you are still unable to access it and any relevant error reported in chrome.

trainerbill commented 7 years ago

No, I have not been able to get this working.

dmfrey commented 7 years ago

@trainerbill if i had to guess, It sounds like the cast receiver app (which runs on the chromecast itself), is can't communicate with your backend. I am running a HLS stream from my hotel room in indianapolis from my backend at my house in Pennsylvania.

dmfrey commented 7 years ago

@trainerbill can you play your HLS streams by going to http://you_backend_ip:6544, then navigate to API -> Examples -> HTTP Live Streaming? If not, there is an issue with producing viable streams on your backend.

trainerbill commented 7 years ago

thx @dmfrey. It may have been my networking setup. However, I ended up going with bubbleupnp. It also allows me to connect and transcode from my HDHomeruns for live tv.

dmfrey commented 7 years ago

closes #106

On Tue, Nov 8, 2016, 11:23 AM Andrew Throener notifications@github.com wrote:

thx @dmfrey https://github.com/dmfrey. It may have been my networking setup. However, I ended up going with bubbleupnp. It also allows me to connect and transcode from my HDHomeruns for live tv.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/106#issuecomment-259181154, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5yzPpPO8CvqhF47wC_JFDS9tE-zoaFks5q8KACgaJpZM4H3Vpa .