Android Open Source - VisEQ Tunnel Player Workaround






From Project

Back to project page VisEQ.

License

The source code is released under:

Copyright (c) 2012, Spotify AB All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:...

If you think the Android project VisEQ listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/**
 * Copyright 2013, Haruki Hasegawa/*  w w w .j a v  a2 s. co  m*/
 *
 * Licensed under the MIT license:
 * http://creativecommons.org/licenses/MIT/
 */

package com.lsu.vizeq.util;

import java.io.IOException;

import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.util.Log;

import com.lsu.vizeq.R;

public class TunnelPlayerWorkaround {
  private static final String TAG = "TunnelPlayerWorkaround";

  private static final String SYSTEM_PROP_TUNNEL_DECODE_ENABLED = "tunnel.decode";

  private TunnelPlayerWorkaround()
  {
  }

  /**
   * Obtain "tunnel.decode" system property value
   * 
   * @param context Context
   * @return Whether tunnel player is enabled
   */
  public static boolean isTunnelDecodeEnabled(Context context)
  {
    return SystemPropertiesProxy.getBoolean(
        context, SYSTEM_PROP_TUNNEL_DECODE_ENABLED, false);
  }

  /**
   * Create silent MediaPlayer instance to avoid tunnel player issue
   * 
   * @param context Context
   * @return MediaPlayer instance
   */
  public static MediaPlayer createSilentMediaPlayer(Context context)
  {
    boolean result = false;

    MediaPlayer mp = null;
    try {
      //mp = MediaPlayer.create(context, R.raw.workaround_1min);
      mp.setAudioStreamType(AudioManager.STREAM_MUSIC);

      // NOTE: start() is no needed
      // mp.start();

      result = true;
    } catch (RuntimeException e) {
      Log.e(TAG, "createSilentMediaPlayer()", e);
    } finally {
      if (!result && mp != null) {
        try {
          mp.release();
        } catch (IllegalStateException e) {
        }
      }
    }

    return mp;
  }
}




Java Source Code List

com.lsu.vizeq.AboutActivity.java
com.lsu.vizeq.Artist.java
com.lsu.vizeq.BackableActivity.java
com.lsu.vizeq.HostActivity.java
com.lsu.vizeq.HostMenuActivity.java
com.lsu.vizeq.HostProfileActivity.java
com.lsu.vizeq.HostSoundVisualizationActivity.java
com.lsu.vizeq.Installation.java
com.lsu.vizeq.LibSpotifyWrapper.java
com.lsu.vizeq.LoginActivity.java
com.lsu.vizeq.MyApplication.java
com.lsu.vizeq.MyCanvas.java
com.lsu.vizeq.PVCircle.java
com.lsu.vizeq.PacketParser.java
com.lsu.vizeq.PlayerActivity.java
com.lsu.vizeq.PreferenceCircle.java
com.lsu.vizeq.PreferenceVisualizationActivity.java
com.lsu.vizeq.PreferenceVisualizer.java
com.lsu.vizeq.ProfileActivity.java
com.lsu.vizeq.RemoteControlReceiver.java
com.lsu.vizeq.RequestDetailsActivity.java
com.lsu.vizeq.RoleActivity.java
com.lsu.vizeq.SearchActivity.java
com.lsu.vizeq.SearchPartyActivity.java
com.lsu.vizeq.ServiceBinder.java
com.lsu.vizeq.SettingsActivity.java
com.lsu.vizeq.SoundVisualizationActivity.java
com.lsu.vizeq.SpotifyService.java
com.lsu.vizeq.TrackRow.java
com.lsu.vizeq.Track.java
com.lsu.vizeq.VisualizerView.java
com.lsu.vizeq.VizEQ.java
com.lsu.vizeq.WebService.java
com.lsu.vizeq.util.SystemPropertiesProxy.java
com.lsu.vizeq.util.SystemUiHiderBase.java
com.lsu.vizeq.util.SystemUiHiderHoneycomb.java
com.lsu.vizeq.util.SystemUiHider.java
com.lsu.vizeq.util.TunnelPlayerWorkaround.java