Advance preparation

Connect the wireless LAN between the smartphone and THETA that runs on the application using this Theta Client.

Initialize THETA Client

import {initialize} from 'theta-client-react-native';

initialize()
  .then(() => {
    // success
  })
  .catch(() => {
    // handle error
  });

OR

initialize('http://<IP address>:<port number>')
  .then(() => {
    // success
  })
  .catch(() => {
    // handle error
  });
Mode Address
Direct mode 192.168.1.1
Other Camera IP address
    <?xml version="1.0" encoding="UTF-8"?>    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<http://www.apple.com/DTDs/PropertyList-1.0.dtd>">
    <plist version="1.0">
      <dict>
        <key>NSAppTransportSecurity</key>
        <dict>
          <key>NSAllowsArbitraryLoads</key>
          <false/>
          <key>NSExceptionDomains</key>
          <dict>
        <key>192.168.1.1</key>
        <dict>
          <key>NSIncludesSubdomain</key>
          <false/>
          <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
          <true/>
          <key>NSTemporaryExceptionRequiresForwardSecrecy</key>
          <false/>
        </dict>
          </dict>
        </dict>
      </dict>
    </plist>
    <?xml version="1.0" encoding="utf-8"?>
    <network-security-config>
      <base-config cleartextTrafficPermitted="false" />
      <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="false">192.168.1.1</domain>
      </domain-config>
    </network-security-config>

Shoot still images

First, shooting settings are performed using getPhotoCaptureBuilder() to create PhotoCapture objects.

import {
  getPhotoCaptureBuilder,
  IsoAutoHighLimitEnum,
  PhotoFileFormatEnum,
} from 'theta-client-react-native';

getPhotoCaptureBuilder()
    .setIsoAutoHighLimit(IsoAutoHighLimitEnum.ISO_1000)
    .setFileFormat(PhotoFileFormatEnum.IMAGE_5K)
    .build()
    .then((photoCapture) => {
      // success build photoCapture
    })
    .catch((error) => {
      // handle error
    });

The above example sets the maximum ISO sensitivity to 1000 and the file format to IMAGE_5K.

See Display a preview for instructions on how to view preview. Next, we call PhotoCapture.takePicture() to shoot still pictures.

photoCapture.takePicture()
  .then(fileUrl => {
    // HTTP GET to fileUrl and receiving a JPEG file
  })
  .catch(error => {
    // catch error while take picture
  });

Shoot a video

First, you set up shooting using getVideoCaptureBuilder() and create VideoCapture objects.

import {
  getVideoCaptureBuilder,
  IsoAutoHighLimitEnum,
  VideoFileFormatEnum,
} from 'theta-client-react-native';

getVideoCaptureBuilder()
  .setIsoAutoHighLimit(IsoAutoHighLimitEnum.ISO_1000)
  .setFileFormat(VideoFileFormatEnum.VIDEO_HD)
  .build()
  .then((videoCapture) => {
    // success build videoCapture
  })
  .catch((error) => {
    // handle error
  });