title: Trouble getting WebVTT captions/subtitles working on Chromecast
body: <p>I'm working on a Chromecast app for Android, and trying to get WebVTT captions/subtitles working. </p>
  
  <p>I instantiate a MediaTrack object as follows:</p>
  
  <pre><code>            MediaTrack track = new MediaTrack.Builder(0, MediaTrack.TYPE_TEXT)
                  .setContentId("http://www.example.com/example.vtt")
                  .setSubtype(MediaTrack.SUBTYPE_SUBTITLES)
                  .setContentType("ISO-8859-1")
                  .setLanguage(Locale.ENGLISH)
                  .setName("English")
                  .build();
  </code></pre>
  
  <p>and add it to a list.</p>
  
  <p>I instantiate MediaInfo using the builder, and include reference the list of tracks using the .setMediaTracks method:</p>
  
  <pre><code>MediaInfo.Builder builder = new MediaInfo.Builder("http://www.example.com/example.m3u8")
                  .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
                  .setContentType("application/vnd.apple.mpegurl")
                  .setMetadata(movieMetadata)
                  .setMediaTracks(mediaTracks).build();
  </code></pre>
  
  <p>In my app I then start the CastControllerActivity that comes with the companion library:</p>
  
  <pre><code>mCastManager.startCastControllerActivity(this, mSelectedMedia, position, autoPlay);
  </code></pre>
  
  <p>After I've done this I set the active media track (only one in my case), and the text track style:</p>
  
  <pre><code>long [] activeTracks = new long[1];
  activeTracks[0] = 0l;
  mCastManager.getRemoteMediaPlayer()
          .setActiveMediaTracks(mCastManager.getGoogleApiClient(), activeTracks)
          .setResultCallback(new MediaResultCallback());
  mCastManager.getRemoteMediaPlayer().setTextTrackStyle(
          mCastManager.getGoogleApiClient(),
          TextTrackStyle.fromSystemSettings(getBaseContext()));
  </code></pre>
  
  <p>When playing a clip containing subtitles the console shows the following:</p>
  
  <pre><code>[775.223s] [cast.receiver.MediaManager] Too many track IDs cast_receiver.js:18
  [775.232s] [cast.receiver.MediaManager] Invalid track IDs cast_receiver.js:18
  [775.238s] [cast.receiver.MediaManager] Sending error: INVALID_REQUEST INVALID_PARAMS 
  </code></pre>
  
  <p>and the status code in the returned ResultCallback is SERVICE_MISSING - even though Google Play Services 5.0.89 is installed on both Android 4.4 devices I'm using when developing. The subtitles are hosted with CORS headers.</p>
  
  <p>Any ideas or pointers?</p>