Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Download videos from the doorbell #49

Closed
XP1 opened this issue Oct 4, 2020 · 3 comments
Closed

Download videos from the doorbell #49

XP1 opened this issue Oct 4, 2020 · 3 comments

Comments

@XP1
Copy link

XP1 commented Oct 4, 2020

I am interested in downloading all the saved videos from the doorbell. Looking at the library, it seems that it only starts a stream.

@FuzzyMistborn
Copy link
Owner

That's correct. There's no way Ive seen to pull the video via the api

@XP1
Copy link
Author

XP1 commented Oct 5, 2020

I decompiled the APK by converting the APK into a JAR using dex2jar and opening the JAR in JD-GUI.

It uses some kind of P2P protocol. Maybe port 32100 UDP cloud protocol?

Here's what I found:

com.oceanwing.battery.cam.history.ui.HistoryVideoActivity:

  void onDownloadClick() {
    HistoryVideoFragment historyVideoFragment = l();
    if (historyVideoFragment != null && !historyVideoFragment.d())
      this.f.a(getResources().getString(R.string.download_this_file), historyVideoFragment.d(false)).show(); 
  }

com.eufy.security.common.R:

  public static final int download_this_file = 2131821792;

com.oceanwing.battery.cam.history.ui.HistoryVideoFragment:

  public void h() {
    if (this.h != null && !TextUtils.isEmpty(this.q)) {
      File file = new File(d(false));
      if (file.exists())
        e.a(file); 
      this.mLlDownloadProgress.setVisibility(0);
      this.mTvDownloadProgress.setText("0%");
      this.z = false;
      this.G = d(true);
      EventData eventData = this.h;
      if (eventData.isDownPriorityCloudOrLocal(eventData.device_sn)) {
        if (this.o == null) {
          this.o = new HubFileDownloader();
          this.o.setHubFileDownloadListener(this.I);
        } 
        this.o.setCancelDownload(false);
        boolean bool = this.h.needConvertResolution();
        int j = this.h.getConvertTargetResolutionWidth();
        int k = this.h.getConvertTargetResolutionHeight();
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("needConvertResolution = ");
        stringBuilder.append(bool);
        com.oceanwing.battery.cam.log.a.a("needConvertResolution", stringBuilder.toString());
        QueryDeviceData queryDeviceData = b.a().b(this.h.device_sn);
        if (queryDeviceData != null && queryDeviceData.isDoorbell()) {
          boolean bool1;
          if (this.h.getBestStoragePathType() == 0) {
            bool1 = false;
          } else {
            bool1 = true;
          } 
          if (bool && j != 0 && k != 0) {
            this.o.initDownloader(this.G, com.oceanwing.battery.cam.common.c.a.e().a(this.h.cipher_id, this.h.cipher_user_id), c.b(this.h.device_sn), c.f(), bool1, bool, j, k);
          } else {
            this.o.initDownloader(this.G, com.oceanwing.battery.cam.common.c.a.e().a(this.h.cipher_id, this.h.cipher_user_id), c.b(this.h.device_sn), c.f(), bool1);
          } 
        } else if ((l.C(this.h.device_sn) || l.E(this.h.device_sn) || c.c(this.h.device_sn) || l.I(this.h.device_sn)) && bool && j != 0 && k != 0) {
          this.o.initDownloader(this.G, com.oceanwing.battery.cam.common.c.a.e().a(this.h.cipher_id, this.h.cipher_user_id), 16000, 1, this.h.getBestStoragePathTypeNew(), bool, j, k);
        } else {
          this.o.initDownloader(this.G, com.oceanwing.battery.cam.common.c.a.e().a(this.h.cipher_id, this.h.cipher_user_id), 16000, 1, this.h.getBestStoragePathTypeNew());
        } 
        P2PReceiver.getInstance().setHubFileDownloader(this.o);
        ZmediaUtil.dowloadMP4(this.j.a(), this.n, this.h.getBestStoragePath());
      } else {
        r();
      } 
      com.oceanwing.battery.cam.base.statistics.logging.a.a.a().a("80021", this.h.device_sn, this.h.station_sn);
    } 
  }

com.oceanwing.battery.cam.zmedia.utils.ZmediaUtil:

  public static void dowloadMP4(String paramString1, MediaAccountInfo paramMediaAccountInfo, String paramString2) {
    ZMediaCom zMediaCom = new ZMediaCom(paramMediaAccountInfo.mInitStr, paramMediaAccountInfo.mDidStr, paramMediaAccountInfo.mHubSn);
    zMediaCom.msgType = 6;
    zMediaCom.mCommandType = 1024;
    zMediaCom.mValueStr = paramString2;
    zMediaCom.mValueStrSub = b.a().d(paramMediaAccountInfo.mHubSn);
    zMediaCom.transaction = paramString1;
    ZMediaManager.getInstance().putMsg(zMediaCom);
  }

com.oceanwing.battery.cam.zmedia.P2PConnection.P2PStatusManager:

public int connectP2P(ZMediaCom paramZMediaCom)

@FuzzyMistborn
Copy link
Owner

Check out #3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants