INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Request for guidance for watching live TV  (Read 1429 times)

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Request for guidance for watching live TV
« on: July 26, 2023, 12:30:20 pm »

I am trying to control all aspects of MC programmatically, as I move my HTPC from using a collection of disparate players to using MC exclusively. The software controls everything through MCWS.

In the MCWS documentation, I see a lot of "Television/xxx" commands. Many of these make sense and I can get all the channel properties and the EPG. And I assume I can set and manage recording schedules as well, but I haven't tried that yet.

But I can't work out what is needed to watch live TV. This works just fine through the UI, but I want to control it remotely.

Is anyone able to provide a brief description of how this is done and how the MCWS operations on channels, players, jtv files etc interact. I tried a combination of PlayChannel --> GetPlayerServingChannel --> GetJTVFile --> PlayByKey (which sort of made sense), but the GetJTVFile failed.

Anyone in a position to help here? Thanks!
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Request for guidance for watching live TV via MCWS
« Reply #1 on: July 27, 2023, 12:54:57 am »

I have found two other threads that mention "GetJTVFile". So (following those) what I have tried is:

Code: [Select]
http://localhost:52199/MCWS/v1/Television/GetPlayerServingChannel?Channel=247904
<Response Status="OK"/>

http://localhost:52199/MCWS/v1/Television/GetPlayerServingChannel?Channel=247904
<Response Status="OK">
<Item Name="TVPlayer">0000028AEF75FFF0</Item>
</Response>

http://localhost:52199/MCWS/v1/Television/GetJTVFile?Channel=247904
<Response Status="Failure"/>

http://localhost:52199/MCWS/v1/Television/GetJTVFile?Channel=247904&TVPlayer=0000028AEF75FFF0
<Response Status="Failure"/>

Is this the correct idea? But why am I seeing the "Failure" responses? And what can I do to diagnose?
Logged

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10876
  • Dogs of the world unite!
Re: Request for guidance for watching live TV
« Reply #2 on: July 27, 2023, 08:53:05 am »

You should just run MC on clients and connect them to the server MC.  TV channels will be played in an MC client without you having to deal with those MCWS calls (MC client does those internally).
Logged
Yaobing Deng, JRiver Media Center

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10876
  • Dogs of the world unite!
Re: Request for guidance for watching live TV via MCWS
« Reply #3 on: July 27, 2023, 09:08:20 am »

I have found two other threads that mention "GetJTVFile". So (following those) what I have tried is:

Code: [Select]
http://localhost:52199/MCWS/v1/Television/GetPlayerServingChannel?Channel=247904
<Response Status="OK"/>

http://localhost:52199/MCWS/v1/Television/GetPlayerServingChannel?Channel=247904
<Response Status="OK">
<Item Name="TVPlayer">0000028AEF75FFF0</Item>
</Response>

http://localhost:52199/MCWS/v1/Television/GetJTVFile?Channel=247904
<Response Status="Failure"/>

http://localhost:52199/MCWS/v1/Television/GetJTVFile?Channel=247904&TVPlayer=0000028AEF75FFF0
<Response Status="Failure"/>

Is this the correct idea? But why am I seeing the "Failure" responses? And what can I do to diagnose?


If your intention is to use your own program to control MC TV, you have the right ideas above.

What is missing is Television/PlayChannel to tell the server to start playing a channel for clients.  After that you need to loop Television/GetPlayerServingChannel and Television/GetJTVFile until they succeed (with a reasonable time-out of course).  The server takes some time to actually get started, and there is no way for clients to know when the server is ready to serve other than looping the calls.

Logged
Yaobing Deng, JRiver Media Center

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10876
  • Dogs of the world unite!
Re: Request for guidance for watching live TV
« Reply #4 on: July 27, 2023, 09:26:30 am »

Since you mentioned porting to Linux in another thread, I should tell you that the client-server TV functions mentioned above are mostly for Windows servers.  We have not implemented all client-server TV functions for non-Windows because our current non-Windows TV support are limited to tuner devices that do streaming (e.g. HDHomeRun).  All such tuners can be directly accessed from any computer on your network, and thus reducing the need for a client-server set up in MC.

If you will keep using a Windows computer for MC server, then the MCWS calls still make sense to some extent.
Logged
Yaobing Deng, JRiver Media Center

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Request for guidance for watching live TV via MCWS
« Reply #5 on: July 27, 2023, 10:41:27 am »


If your intention is to use your own program to control MC TV, you have the right ideas above.

What is missing is Television/PlayChannel to tell the server to start playing a channel for clients.  After that you need to loop Television/GetPlayerServingChannel and Television/GetJTVFile until they succeed (with a reasonable time-out of course).  The server takes some time to actually get started, and there is no way for clients to know when the server is ready to serve other than looping the calls.

Yes, that is absolutely my intention. I have been doing this in my HTPC (and incorporating a remotely-controlled MC) for more than 20 years now. If you are curious, see a (rather old) video at https://youtu.be/PSX-_iy29Pk.

So thank you for the hint about the missing call (which I did run, but forgot to include in my posting) and the need to possibly loop a few times. I shall experiment along those lines. It is very useful to know that I am heading off on the right direction.
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Request for guidance for watching live TV
« Reply #6 on: July 27, 2023, 11:00:41 am »

Since you mentioned porting to Linux in another thread, I should tell you that the client-server TV functions mentioned above are mostly for Windows servers.  We have not implemented all client-server TV functions for non-Windows because our current non-Windows TV support are limited to tuner devices that do streaming (e.g. HDHomeRun).  All such tuners can be directly accessed from any computer on your network, and thus reducing the need for a client-server set up in MC.

If you will keep using a Windows computer for MC server, then the MCWS calls still make sense to some extent.

Thank you for the advance warning. My move towards Linux is multi-stage:
  • Get a HDHomeRun tuner and configure MC to use it
  • Re-write my middleware app to use MC for all player functions, replacing Zoom Player and DVBViewer
  • Re-platform the middleware to something (.Net Core 6) that can also run on Linux
  • Get the middleware and MC running on a Linux VM or re-purposed old PC box running Linux
  • Replace the OS on the existing domestic HTPC hardware from Windows to Linux
The intent is that the control UI on phones etc ends up only cosmetically different from the current controls. But going forward, there may be additional functionality enabled by use of MC

I am currently half way through step 2. If I can't get TV control working on MC on Linux, then I will stop at step 3. BUT I am sure I will then start to nag you to get more of MCWS working.

Perhaps relevant, I am not using MC as a master/server system - MCWS is just used for control. So maybe it could work on Linux anyway. I will certainly let you know!  ;D
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Request for guidance for watching live TV via MCWS
« Reply #7 on: July 27, 2023, 01:33:43 pm »

I shall experiment along those lines. It is very useful to know that I am heading off on the right direction.

Well, it might be the right direction, but I cannot get it to work at all. I am sending the MCWS commands from a browser and manually retrying them "in a loop" between the manual commands. And GetJTVFile always fails.

I have found a really ugly work-around but I will go with that if there are no other ideas. Firstly
Code: [Select]
http://localhost:52199/MCWS/v1/Control/MCC?Command=30002 appears to start the TV with a play queue of all available channels. Then I can use
Code: [Select]
http://localhost:52199/MCWS/v1/Playback/PlayByIndex?Index=NNN to select channel (where NNN is a zero-based index into the array of channels.

It sounds a bit fragile, but it seems to work. Any comments?

Logged

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10876
  • Dogs of the world unite!
Re: Request for guidance for watching live TV
« Reply #8 on: July 27, 2023, 01:57:18 pm »

Is the server on Windows?  The server must be on Windows. 

Is the tuner a bda tuner?  If the client is also on a Windows computer, then the tuner type cam be bda, analog, or OpenCable.  If the client is not Windows, then the tuner on Windows server must be a bda tuner, and the time-shifting mode set to "Transport Stream Time-shifting".
Logged
Yaobing Deng, JRiver Media Center

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Request for guidance for watching live TV
« Reply #9 on: July 27, 2023, 02:56:12 pm »

Is the server on Windows?  The server must be on Windows. 

Is the tuner a bda tuner?  If the client is also on a Windows computer, then the tuner type cam be bda, analog, or OpenCable.  If the client is not Windows, then the tuner on Windows server must be a bda tuner, and the time-shifting mode set to "Transport Stream Time-shifting".
The server is on Windows. In my setup, the server and client are always the same machine. That's currently Windows, but I am still hoping for Linux later on.

The tuner is HDHomeRun. And that seems to work fine for everything I have tried through the MC UI. However, there is also a dual BDA PCI tuner in my development PC, which I haven't yet removed. It would be used by DVBViewer if I were to start that service. But MC is configured for the HDHomeRun only.
Logged

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10876
  • Dogs of the world unite!
Re: Request for guidance for watching live TV
« Reply #10 on: July 27, 2023, 05:43:34 pm »

The server is on Windows. In my setup, the server and client are always the same machine. That's currently Windows, but I am still hoping for Linux later on.

The tuner is HDHomeRun. And that seems to work fine for everything I have tried through the MC UI. However, there is also a dual BDA PCI tuner in my development PC, which I haven't yet removed. It would be used by DVBViewer if I were to start that service. But MC is configured for the HDHomeRun only.

HDHomeRun devices can be used in two modes - bda and DMS.  The former uses Microsoft's bda architecture with DirectShow, and the latter is Digital Media Server - streaming from the device.  The MCWS Television functions mostly are for bda tuners.  So if your channels are set up as DMS channels, the MCWS functions do not work as I have not implemented them for DMS channels.
Logged
Yaobing Deng, JRiver Media Center

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Request for guidance for watching live TV
« Reply #11 on: July 28, 2023, 04:22:13 am »

HDHomeRun devices can be used in two modes - bda and DMS.  The former uses Microsoft's bda architecture with DirectShow, and the latter is Digital Media Server - streaming from the device.  The MCWS Television functions mostly are for bda tuners.  So if your channels are set up as DMS channels, the MCWS functions do not work as I have not implemented them for DMS channels.
That really helped me - thank you.  I had not understood the two modes and I had configured for DMS streaming. I had to reconfigure MC for "Antenna (over the air)" rather than the (more obvious to me) "Streaming". I can now watch TV using that mode.

And GetJTVFile now returns the documented data.

But ... next issue ... when I PlayByKey the key value from GetJTVFile, the MCWS operation returns OK, but my MC UI displays an error:
Code: [Select]
"No television tuner is available to fulfill your request. Please make sure you have a device that is not in use"Device 0 is tuned to the right channel and TV Status shows
Code: [Select]
Here is a list of the status of television devices, followed by a list of recording actions that are queued.
This text has been copied to the clipboard.

=== Television Devices ===

Device 0: Silicondust HDHomeRun Tuner 12607E78-0 687DAB1CB79A0E8C (digital)
State: Serving clients
Channel: 103 ITV1 HD
Recording Rule IDs:
Tuner Type: DVB-T

Device 1: Silicondust HDHomeRun Tuner 12607E78-1 687DAB1CB79A0E8D (digital)
State: Idle

Device 2: Silicondust HDHomeRun Tuner 12607E78-2 687DAB1CB79A0E8E (digital)
State: Idle

Device 3: Silicondust HDHomeRun Tuner 12607E78-3 687DAB1CB79A0E8F (digital)
State: Idle

Device 4: 7231 BDA Analog Capture 18ED9C08E20E7E42 (analog)
State: Idle

... and other devices

Any ideas?? I'm sorry for keeping coming back to you!
Logged

avid

  • Regular Member
  • World Citizen
  • ***
  • Posts: 180
  • MC user since 2003
Re: Request for guidance for watching live TV
« Reply #12 on: July 28, 2023, 11:58:34 am »

I now believe I understand the issues and design much more clearly. It seems that I have a choice between two strategies going forward.

One is to access the HDHomeRun as a DMS streamer. This means that I can't use all the MCWS calls (at least not GetJTVFile). But most of the other Television/XXX calls that I have tried seem to work. I can use Control/MCC?Command=30002 to play live TV and PlayByIndex in order to select the channel. The remaining unknown is whether MCWS control of scheduled recordings will work, but I think they might. The EPG certainly does.

The second is to configure the HDHomeRun as virtual BDA DVB-T2 tuners. Then I can use all the MCWS calls as designed and documented - subject to sorting the most recent "No television tuner is available to fulfill your request" message.

If I can get strategy one working, then I can probably move the system onto Linux. Otherwise it will have to remain on Windows :(, albeit with a much more clean and consistent user experience with MC only, compared to the current multi-player implementation.
Logged
Pages: [1]   Go Up