Ejemplo n.º 1
0
 @Override
 public void onReceive(Context context, Intent intent) {
   if (PipeLine.PIPELINE_URLTRANSLATIONREPORTED.equals(intent.getAction())) {
     String resultKey =
         intent.getStringExtra(PipeLine.PIPELINE_URLTRANSLATIONREPORTED_RESULTKEY);
     String url = intent.getStringExtra(PipeLine.PIPELINE_URLTRANSLATIONREPORTED_URL);
     final Result result = Result.getResultByKey(resultKey);
     mTranslatedUrls.put(Result.getResultByKey(resultKey), url);
     new Handler()
         .postDelayed(
             new Runnable() {
               @Override
               public void run() {
                 mTranslatedUrls.remove(result);
               }
             },
             300000);
     if (mPreparingQuery != null && result == mPreparingQuery.getPreferredTrackResult()) {
       prepare(mPreparingQuery);
     }
   }
 }
Ejemplo n.º 2
0
 /** Prepare the given url */
 private MediaPlayerInterface prepare(Query query) {
   mPreparedQuery = null;
   mPreparingQuery = query;
   release();
   if (mLibVLC == null) {
     return null;
   }
   Result result = query.getPreferredTrackResult();
   if (PipeLine.PLUGINNAME_BEATSMUSIC.equals(result.getResolvedBy().getId())
       || PipeLine.PLUGINNAME_GMUSIC.equals(result.getResolvedBy().getId())) {
     if (mTranslatedUrls.get(result) == null) {
       ((ScriptResolver) result.getResolvedBy()).getStreamUrl(result);
     } else {
       mLibVLC.playMRL(LibVLC.PathToURI(mTranslatedUrls.get(result)));
       onPrepared(null);
     }
   } else {
     mLibVLC.playMRL(LibVLC.PathToURI(result.getPath()));
     onPrepared(null);
   }
   return this;
 }