本文整理汇总了Java中org.appcelerator.titanium.util.Log.w方法的典型用法代码示例。如果您正苦于以下问题:Java Log.w方法的具体用法?Java Log.w怎么用?Java Log.w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.appcelerator.titanium.util.Log
的用法示例。
在下文中一共展示了Log.w方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pause
import org.appcelerator.titanium.util.Log; //导入方法依赖的package包/类
public void pause()
{
try {
if (mp != null) {
am.setMode(AudioManager.USE_DEFAULT_STREAM_TYPE);
am.setSpeakerphoneOn(true);
if(mp.isPlaying()) {
if (DBG) {
Log.d(LCAT,"audio is playing, pause");
}
//if (remote) {
stopProgressTimer();
//}
mp.pause();
paused = true;
setState(STATE_PAUSED);
}
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while pausing : " , t);
}
}
示例2: reset
import org.appcelerator.titanium.util.Log; //导入方法依赖的package包/类
public void reset()
{
try {
if (mp != null) {
//if (remote) {
stopProgressTimer();
//}
setState(STATE_STOPPING);
mp.stop();
mp.seekTo(0);
looping = false;
paused = false;
setState(STATE_STOPPED);
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while resetting : " , t);
}
}
示例3: setVolume
import org.appcelerator.titanium.util.Log; //导入方法依赖的package包/类
public void setVolume(float volume)
{
try {
if (volume < 0.0f) {
this.volume = 0.0f;
Log.w(LCAT, "Attempt to set volume less than 0.0. Volume set to 0.0");
} else if (volume > 1.0) {
this.volume = 1.0f;
proxy.setProperty(PROPERTY_VOLUME, volume);
Log.w(LCAT, "Attempt to set volume greater than 1.0. Volume set to 1.0");
} else {
this.volume = volume; // Store in 0.0 to 1.0, scale when setting hw
}
if (mp != null) {
float scaledVolume = this.volume;
mp.setVolume(scaledVolume, scaledVolume);
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while setting volume : " , t);
}
}
示例4: release
import org.appcelerator.titanium.util.Log; //导入方法依赖的package包/类
public void release()
{
try {
if (mp != null) {
mp.setOnCompletionListener(null);
mp.setOnErrorListener(null);
mp.setOnBufferingUpdateListener(null);
mp.setOnInfoListener(null);
mp.setOnPreparedListener(null);
/*
* Restore default stream type
*/
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.KITKAT) {
am.setMode(AudioManager.USE_DEFAULT_STREAM_TYPE);
am.setSpeakerphoneOn(true);
}
mp.release();
mp = null;
if (DBG) {
Log.d(LCAT, "Native resources released.");
}
remote = false;
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while releasing : " , t);
}
}
示例5: setLooping
import org.appcelerator.titanium.util.Log; //导入方法依赖的package包/类
public void setLooping(boolean loop)
{
try {
if(loop != looping) {
if (mp != null) {
mp.setLooping(loop);
}
looping = loop;
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while configuring looping : " , t);
}
}
示例6: initialize
import org.appcelerator.titanium.util.Log; //导入方法依赖的package包/类
protected void initialize()
throws IOException
{
try {
setState(STATE_STARTING);
mp = new MediaPlayer();
String url = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_URL));
if (URLUtil.isAssetUrl(url)) {
String path = url.substring(TiConvert.ASSET_URL.length());
AssetFileDescriptor afd = null;
try {
afd = context.getAssets().openFd(path);
// Why mp.setDataSource(afd) doesn't work is a problem for another day.
// http://groups.google.com/group/android-developers/browse_thread/thread/225c4c150be92416
mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
} catch (IOException e) {
Log.e(LCAT, "Error setting file descriptor: ", e);
} finally {
if (afd != null) {
afd.close();
}
}
} else {
Uri uri = Uri.parse(url);
if (uri.getScheme().equals(TiC.PROPERTY_FILE)) {
mp.setDataSource(uri.getPath());
} else {
Log.d(LCAT,"audio is a remote url." + url);
// IceCastScraper ic = new IceCastScraper();
// List<Stream> streams = ic.scrape(URI.create(url));
// String song = streams.get(0).getCurrentSong();
// String songUrl = streams.get(0).getUri().toString();
// Log.d(LCAT,"audio song. " + song);
// Log.d(LCAT,"audio URL. " + songUrl);
//
// ShoutCastScraper sc = new ShoutCastScraper();
// List<Stream> streams = sc.scrape(URI.create(url));
//
// Log.d(LCAT,"streams count " + streams.size());
//
// String song = streams.get(0).getCurrentSong();
// String songUrl = streams.get(0).getUri().toString();
// Log.d(LCAT,"audio song. " + song);
// Log.d(LCAT,"audio URL. " + songUrl);
remote = true;
mp.setDataSource(url);
}
}
setSpeakerphoneOn(); // Configures initial audio routing
mp.setLooping(looping);
mp.setOnCompletionListener(this);
mp.setOnErrorListener(this);
mp.setOnInfoListener(this);
mp.setOnBufferingUpdateListener(this);
mp.setOnPreparedListener(this);
mp.prepare(); // Probably need to allow for Async
setState(STATE_INITIALIZED);
setVolume(volume);
if (proxy.hasProperty(TiC.PROPERTY_TIME)) {
setTime(TiConvert.toInt(proxy.getProperty(TiC.PROPERTY_TIME)));
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while initializing : " , t);
release();
setState(STATE_STOPPED);
}
}
示例7: play
import org.appcelerator.titanium.util.Log; //导入方法依赖的package包/类
public void play()
{
try {
if (mp != null) {
if (!isPlaying()) {
if (DBG) {
Log.d(LCAT,"audio is not playing, starting.");
}
setVolume(volume);
if (DBG) {
Log.d(LCAT, "Play: Volume set to " + volume);
}
OnAudioFocusChangeListener focusChangeListener =
new OnAudioFocusChangeListener() {
public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case (AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) :
// Lower the volume while ducking.
mp.setVolume(0.2f, 0.2f);
break;
case (AudioManager.AUDIOFOCUS_LOSS_TRANSIENT) :
pause();
break;
case (AudioManager.AUDIOFOCUS_LOSS) :
stop();
break;
case (AudioManager.AUDIOFOCUS_GAIN) :
// Return the volume to normal and resume if paused.
mp.setVolume(1f, 1f);
play();
break;
default:
// Nothing
break;
}
}
};
am.requestAudioFocus(focusChangeListener, (speakerphone) ? AudioManager.STREAM_MUSIC : AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN);
if(!speakerphone) {
am.setMode(AudioManager.STREAM_VOICE_CALL);
am.setSpeakerphoneOn(false);
} else {
am.setSpeakerphoneOn(true);
}
mp.start();
setState(STATE_PLAYING);
paused = false;
//if (remote) {
startProgressTimer();
//}
}
setState(STATE_PLAYING);
}
} catch (Throwable t) {
Log.w(LCAT, "Issue while playing : " , t);
reset();
}
}