コード例 #1
0
ファイル: RichMediaView.java プロジェクト: zhangqibo/adkey
 private void setAdvImgPathAndRequestNext() {
   String localfile = Const.DOWNLOAD_PATH + Util.VideoFileDir + Const.DOWNLOADING_SMALLVIDEO;
   File tempFile = new File(localfile);
   if (!tempFile.exists()) {
     RichMediaAd tempad =
         (RichMediaAd)
             serializeManager.readSerializableData(Const.DOWNLOAD_PATH + Util.VideoFileDir + "ad");
     if (tempad != null) {
       mAd = tempad;
     }
   }
   String pathTemp = Const.DOWNLOAD_PATH + Util.VideoFileDir + "ad";
   File cacheDir = new File(Const.DOWNLOAD_PATH + Util.VideoFileDir);
   if (!cacheDir.exists()) cacheDir.mkdirs();
   new DownloadSmallVideoThread(pathTemp, mContext, request).start();
 }
コード例 #2
0
ファイル: RichMediaView.java プロジェクト: zhangqibo/adkey
  private void setAdvPathAndRequestNext() {
    String localfile = Const.DOWNLOAD_PATH + Util.VideoFileDir + Const.DOWNLOADING_SMALLVIDEO;
    File tempFile = new File(localfile);
    if (!tempFile.exists()) {
      RichMediaAd tempad =
          (RichMediaAd)
              serializeManager.readSerializableData(Const.DOWNLOAD_PATH + Util.VideoFileDir + "ad");
      if (tempad != null) {
        mAd = tempad;
        if (tempad.getVideo() != null) {
          this.mVideoData.videoUrl = mAd.getVideo().videoUrl;
        } else {
          initInterstitialView();
        }
      }
    }
    String path = this.mVideoData.videoUrl;
    Log.d("Jas", "path1=" + path);
    if (Util.CACHE_MODE) {
      if (Util.PlayingSmallVideoName == null) {
        path =
            getPlayPath(
                Const.DOWNLOAD_PATH
                    + Util.VideoFileDir
                    + Const.DOWNLOAD_SMALLVIDEO
                    + Util.ExternalName,
                path);
        Log.d("Jas", "path2=" + path);
      } else {
        if (Util.PlayingSmallVideoName.contains("_ts")) { // is playing done
          path =
              getPlayPath(
                  Const.DOWNLOAD_PATH
                      + Util.VideoFileDir
                      + Const.DOWNLOAD_SMALLVIDEO
                      + Util.ExternalName,
                  path);
          Log.d("Jas", "path3=" + path);
        } else if (Util.PlayingSmallVideoName.contains("http")) { // is playing online	
          path =
              getPlayPath(
                  Const.DOWNLOAD_PATH
                      + Util.VideoFileDir
                      + Const.DOWNLOAD_SMALLVIDEO
                      + Util.ExternalName,
                  path);
          Log.d("Jas", "path4=" + path);
        } else { // is playing ts
          path =
              getPlayPath(
                  Const.DOWNLOAD_PATH
                      + Util.VideoFileDir
                      + Const.DOWNLOAD_SMALLVIDEO
                      + "_ts"
                      + Util.ExternalName,
                  path);
          Log.d("Jas", "path5=" + path);
        }
      }
    }
    Log.d("Jas", "path6=" + path);
    new ImpressionThread(
            mContext, mAd.getmImpressionUrl(), Util.PublisherId, Util.AD_TYPE.FULL_SCREEN_VIDEO)
        .start();
    // change by Jas
    if (mAd.getmTrackingUrl().size() > 0) {
      AdMonitorManager.getInstance(mContext).AddTRACKINGURL(mAd.getmTrackingUrl());
    }
    // end change by Jas
    Util.PlayingSmallVideoName = path;
    this.mVideoView.setVideoPath(path);
    String pathTemp = Const.DOWNLOAD_PATH + Util.VideoFileDir + "ad";
    File cacheDir = new File(Const.DOWNLOAD_PATH + Util.VideoFileDir);
    if (!cacheDir.exists()) cacheDir.mkdirs();

    new DownloadSmallVideoThread(pathTemp, mContext, request).start();
  }