title: Google TV VideoView 'Failed to Play'
body: <p>I'm trying to play a video in a VideoView on a Sony GTV (Android 3.2) and when the VideoView loads I get a 'Failed to Play' dialog. The output of ffmpeg -i on my video is:</p>
  
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vz569287a41cd749cd8c0692a64d94453c.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      creation_time   : 1970-01-01 00:00:00
      encoder         : Lavf53.4.0
    Duration: 00:00:21.96, start: 0.000000, bitrate: 1166 kb/s
      Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 576x432 [SAR 1:1 DAR 4:3], 1070 kb/s, 23.99 fps, 23.95 tbr, 479 tbn, 47.90 tbc
      Metadata:
        creation_time   : 1970-01-01 00:00:00
        handler_name    : VideoHandler
      Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 91 kb/s
      Metadata:
        creation_time   : 1970-01-01 00:00:00
        handler_name    : 
  </code></pre>
  
  <p>According to: <a href="https://developers.google.com/tv/android/docs/gtv_media_formats" rel="nofollow">https://developers.google.com/tv/android/docs/gtv_media_formats</a> h264 baseline with aac audio should be supported but has limited B-frame support. Is there a way to determine that the baseline profile is the issue?</p>
  
  <p>The video plays fine on tablets running ICS (I don't have a Honeycomb tablet to test on).</p>
  
  <p>The video can be found at:
  <a href="https://view.vzaar.com/933735/video" rel="nofollow">https://view.vzaar.com/933735/video</a></p>
  
  <p>Logcat output (from Logitech Revue, Sony device was unavailable):</p>
  
  <pre><code>04-26 18:38:36.409: W/AVInfo(1669): av_open_input_file https://view.vzaar.com/933735/video failed -2
  04-26 18:38:36.409: I/MediaPlayerService(1669): getPlayerTypeFromProbe: https://view.vzaar.com/933735/video choose player type 0
  
  04-26 18:40:45.325: I/AudioService(193):  AudioFocus  requestAudioFocus() from android.media.AudioManager@67001460com.google.tv.player.PlayerActivity$7@66c75718
  04-26 18:40:45.373: D/MediaPlayer(21235): Couldn't open file on client side, trying server side
  04-26 18:40:45.373: I/HDMIPassthru(1669): Creating pure ISMD based HDMIPassthruPlayer for Sodaville platform
  04-26 18:40:45.373: V/GoogleTVMediaApi(1669): ui_plane_match: 1, display_mode_size_match: 0, tgtW = 1280, tgtH = 720
  04-26 18:40:45.373: V/GoogleTVMediaApi(1669): Update Video Params
  04-26 18:40:45.373: V/GoogleTVMediaApi(1669): Ideal      : 1204x672 @ (38, 24)
  04-26 18:40:45.373: V/GoogleTVMediaApi(1669): Ideal Crop : 0x0 @ (0, 0)
  04-26 18:40:45.373: V/GoogleTVMediaApi(1669): Scale      : 1280x720
  04-26 18:40:45.373: V/GoogleTVMediaApi(1669): Crop       : 1280x720 @ (0, 0)
  04-26 18:40:45.373: V/GoogleTVMediaApi(1669): Src        : 1280x720 @ (0, 0)
  04-26 18:40:45.373: V/GoogleTVMediaApi(1669): Dst        : 1280x720 @ (0, 0)
  04-26 18:40:45.373: D/HDMIPassthru(1669): Create ISMD_HDMIPassthruPlayer
  04-26 18:40:45.377: I/HDMIPassthru(1669): Got init display mode 1280x720p@59.939999   M
  04-26 18:40:45.377: I/HDMIPassthru(1669): Set data source: hdmi://localhost?port=2
  04-26 18:40:45.385: D/HDMIPassthru(1669): ISMD_HDMIPassthruPlayer prepareAsync (port=2 ignored, no input port control library detected)
  04-26 18:40:45.405: D/MediaPlayer(21235): getMetadata
  04-26 18:40:45.405: E/MediaPlayerService(1669): getMetadata failed -38
  04-26 18:40:45.409: I/AudioService(193):  AudioFocus  requestAudioFocus() from android.media.AudioManager@67001460com.google.tv.player.PlayerActivity$7@66c75718
  04-26 18:40:45.409: D/HDMIPassthru(1669): virtual android::status_t fishtank::ISMD_HDMIPassthruPlayer::setVolume(float, float) 1.000000 1.000000
  04-26 18:40:45.409: D/HDMIPassthru(1669): android::status_t fishtank::ISMD_HDMIPassthruPlayer::applyVolume() 0
  04-26 18:40:45.409: W/HDMIPassthru(1669): Failed to get dev handle for setOutputVolume.
  04-26 18:40:45.409: D/HDMIPassthru(1669): ISMD_HDMIPassthruPlayer start
  04-26 18:40:45.409: D/GtvResourceManager(137): Allocate resource holder for context 546063a61f 0x9485718 124
  04-26 18:40:45.409: D/GtvResourceManager(137): Allocate resource holder for context 546063a61f 0x9487fc0 125
  04-26 18:40:45.409: D/IsmdResourceManager(137): resource update 0 for 4 1 0x9485718
  04-26 18:40:45.413: D/HDMIPassthru(1669): Action 0 for device type 4 index 1
  04-26 18:40:45.417: D/IsmdResourceManager(137): resource update 0 for 1 0 0x9485718
  04-26 18:40:45.417: D/HDMIPassthru(1669): Action 0 for device type 1 index 0
  04-26 18:40:45.417: D/IsmdResourceManager(137): resource update 0 for 3 1 0x9485718
  04-26 18:40:45.417: D/HDMIPassthru(1669): Action 0 for device type 3 index 1
  04-26 18:40:45.417: D/IsmdResourceManager(137): resource update 0 for 0 4 0x9485718
  04-26 18:40:45.417: D/HDMIPassthru(1669): Action 0 for device type 0 index 0
  04-26 18:40:45.417: I/HDMIPassthru(1669): ISMD Passthru player was assigned plane 4
  04-26 18:40:45.449: D/HDMIPassthru(1669): android::status_t fishtank::ISMD_HDMIPassthruPlayer::applyVolume() 0
  04-26 18:40:45.449: D/HDMIPassthru(1669): virtual android::status_t fishtank::ISMD_HDMIPassthruPlayer::setVolume(float, float) 1.000000 1.000000
  04-26 18:40:45.449: D/HDMIPassthru(1669): android::status_t fishtank::ISMD_HDMIPassthruPlayer::applyVolume() 0
  04-26 18:40:45.449: I/AudioService(193):  AudioFocus  requestAudioFocus() from android.media.AudioManager@67001460com.google.tv.player.PlayerActivity$7@66c75718
  04-26 18:40:45.449: D/HDMIPassthru(1669): virtual android::status_t fishtank::ISMD_HDMIPassthruPlayer::setVolume(float, float) 1.000000 1.000000
  04-26 18:40:45.449: D/HDMIPassthru(1669): android::status_t fishtank::ISMD_HDMIPassthruPlayer::applyVolume() 0
  04-26 18:40:45.489: I/HDMIPassthru(1669): IsVideoModeChangeNeeded, no change needed, staying in mode 1280x720p@59.94M
  04-26 18:40:45.513: I/HDMIPassthru(1669): Audio Mode Change: 0 format 0 channel 0 Hz (0/0) 0 bits/sample.  Signal absent
  04-26 18:40:45.513: I/HDMIPassthru(1669): Audio Input: Muted
  04-26 18:40:45.513: W/HDMIPassthru(1669): Invalid audio mode received for dev 32. (ismd_res = 0) ss 0 fs 0
  04-26 18:40:45.513: I/HDMIPassthru(1669): Audio Input: Un-Muted
  04-26 18:40:45.513: I/HDMIPassthru(1669): HDCP status = disabled.
  04-26 18:40:45.513: I/HDMIPassthru(1669): handleVideoMute: video not muted
  04-26 18:40:45.513: E/HDMIPassthru(1669): HDMI Passthru: Video Renderer Error Event Received
  04-26 18:40:45.525: D/MediaDevicesService(282): Media devices in use (acquisition - Logitech01@com.logitech.harmony)
  04-26 18:40:45.525: D/MediaDevicesService(282):  - Logitech01@com.logitech.harmony
  04-26 18:40:45.537: D/DeviceAcquisitionService(333): ON_BIND: (DeviceId) - Logitech01
  </code></pre>
  
  <p>I don't have the Sony devices at the moment to test on so pulled this logcat from a Logitech Revue. Strangely an even worse issue has occurred here as the when setting the video URI the Revue just displays a black screen and any keyboard input results in an ANR.</p>
  
  <p>My code to start the video looks like:</p>
  
  <pre><code>public void onStart() {
      super.onStart();
      MediaController mc = new MediaController(getSlideActivity());
      mc.setAnchorView(mVideo);
      mVideo.setMediaController(mc);
      mVideo.setVideoURI(Uri.parse("https://view.vzaar.com/933735/video"));
      mVideo.start();
  }
  </code></pre>
  
  <p>I modified the video playing code to be within an AsyncTask and it no longer crashes on the Revue (though video doesn't play):</p>
  
  <pre><code>new AsyncTask&lt;Void, Void, Void&gt;() {
          @Override
      protected Void doInBackground(Void... params) {
          Looper.prepare();   
          MediaController mc = new MediaController(getSlideActivity());
          mc.setAnchorView(mVideo);
          mVideo.setMediaController(mc);
          mVideo.setVideoURI(Uri.parse(mSlide.getMedia()));
          Looper.loop();
          return null;
      }
  
      @Override
      protected void onPostExecute(Void v) {
          mVideo.start();
      }
  }.execute();
  </code></pre>
  
  <p>After adding some logging statements to the AsyncTask above I see it never gets past the line that calls 'setVideoURI'.</p>