Upcoming search in Couch Tv

It has been a couple of days since the last update, but I am excited to share what I have been working on in that time:

Search

To be able to quickly search through your own library of content is something that I have needed for awhile and makes it easier for the rest of the family to find the movies they want to see rather than browsing through the library to the correct folder.

Text Search

The technical side really isn’t that interesting. I am using SQLite on the Tv, and using the C api to interact with the local database. The title, description, actors, directors and genres are all indexed and all searched at the same time. That means that a more freeform search such as “Children” will return children movies and searching for Vin Diesel will return his movies in your library. There is still some performance tweaks that have to be done before shipping but here is a sneak peak:

Thanks for reading

Upcoming changes to Couch Tv

It has been awhile since the last Couch Tv update and I wanted to provide some updates as to what’s coming in the next update.

Color

The dark grays are gone

And are replaced with a orange and red gradient

dark grays are gone

Video screen

The video screen has been completely redesigned from this:

to this:

New Video Screen

There are quite a few things that have changed here

  • Preview button
  • Play button has text only
  • Centered the title
  • Removed text no one looked at and moved the description to the info bar
  • Moved the progress bar to underneath the title
  • Removed the poster image (sort of)
  • Added movie frame(s) as background images

Preview

Clicking the preview button will randomly pick out a 30 second clip from the video and play it. This feature is great if you aren’t quite sure what you are in the mood to watch and want a quick “preview"

Video description

The video description and poster has been added to the Tv info bar

Tron Info Bar

Background

Before the video is loaded to pull frames, the background color is changed to a gradient to try and match the major colors of the poster image:

basic video screen

If you haven’t finished watching the video, the frame as the video pause point is displayed as the background causing the poster image to fade out:

Pixar continue UI

One main benefit of displaying the paused frame is that the transition from the static background to the video player isn’t as jarring to the user:

For any videos that are not in the continue watch list, multiple frames from the video are downloaded and are presented as a slideshow:

 

This update is compatible with tvOS 9.2 and I hope to have this update out in the next few weeks

Thanks for reading

Couch Tv 1.5.2 and UPnP

Couch Tv 1.5.2 is mainly a bugfix update that fixes a UPnP scanning error that only affects first time users of Couch Tv. This post goes into some technical detail but I thought it necessary to provide some insight into how this bug occurred and how it was fixed.

Couch Tv 1.5.2 has been submitted for review and an expedited review has been requested.

Update: Couch Tv 1.5.2 has been approved and is available for download.

Increasing numbers of people are seeing this when launching Couch Tv for the first time:

NoServersError

To see if I could replicate the experience first time users are getting, I decided to delete my development build off of my Tv and download a fresh copy from the AppStore. Boom at first launch I see the above error. The problem now is I can’t debug the AppStore version since debugging information is stripped before being uploaded to the AppStore.

I then deleted the AppStore copy and loaded the current development build and ran into the same problem but at least I can debug Couch Tv in Xcode and look at debug logging. Part of the scanning process involves Couch Tv sending a UDP packet to multicast address 239.255.255.250 port 1900 with the following payload:

M-SEARCH * HTTP/1.1\r\n

HOST:239.255.255.250:1900\r\n

MAN:\"ssdp:discover\"\r\n

ST:ssdp:all\r\n

MX:3\r\n\r\n

 

A UPnP server (Plex in this example) on the local network responds with the following data: 

HTTP/1.1 200 OK

Location: http://192.168.3.4:32469/DeviceDescription.xml

Cache-Control: max-age=1800

Server: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.4.11

EXT: 

USN: uuid:46ca2c9b-bfd7-a2a0-74fb-3d6491fd488c::urn:schemas-upnp-org:device:MediaServer:1

ST: urn:schemas-upnp-org:device:MediaServer:1

Date: Thu, 25 Feb 2016 15:25:23 GMT


This told me that the scanning was correct and that the Plex server was responding properly so the bug must be in validating the server information. The bug was actually introduced in version 1.5 when filtering out non media server UPnP servers such as networked receivers. And since scanning is typically done only the first time you launch Couch Tv (servers are cached afterwards), I didn’t see this bug until after I deleted Couch Tv and started over with no cached data.

Prior to 1.5, Couch Tv would detect multiple UPnP servers and connect to the first one that responded with the above information.  I soon found out that many different devices use the DLNA protocol and needed a way to only connect to those servers who could actually serve video content.

So far as using SSDP for DLNA server discovery, I have found that only some (not all) DLNA servers respond to the query:

M-SEARCH * HTTP/1.1\r\n

HOST:239.255.255.250:1900\r\n

MAN:\"ssdp:discover\"\r\n

ST:ssdp:all\r\n

MX:3\r\n\r\n

 

and others respond to the query slightly modified:

M-SEARCH * HTTP/1.1\r\n

HOST:239.255.255.250:1900\r\n

ST: urn:schemas-upnp-org:device:MediaServer:1\r\n

MAN:\"ssdp:discover\"\r\n

MX:3\r\n\r\n

 

Changing the ST field from ssdp:all in the first query to urn:schemas-upnp-org:device:MediaServer:1 seems to make all the difference depending on the DLNA server.

Finally as part of this update, I added focus support on the video information screen, so the video poster responds to the user’s touch on the Tv remote:

Thanks for reading