// Set this phone's status on Firebase at /cameras/{cameranumber}/mFirebaseRef = new Firebase(FIREBASE_BASE_URL);mCameraStatusRef = mFirebaseRef.child("cameras").child(cameraNumber);CameraStatus mCameraStatus = new CameraStatus();mCameraStatus.appVersion = BuildConfig.VERSION_NAME;mCameraStatus.externalMic = mExternalMic;...mCameraStatus.status = status;mCameraStatusRef.setValue(mCameraStatus);
// Name of the Google Cloud Storage bucket.String bucket = "my-cloudspin-bucket";// Destination URL in the Cloud Storage bucket.String cloudStoragePath = "20150821-151824-892/videos/01.mp4";// Video file to upload.File videoFile = new File("...");// Credentials for Google Cloud Platform.Credential credential = ...Storage storage = new Storage.Builder(new NetHttpTransport(),new JacksonFactory(),credential).setApplicationName("...@developer.gserviceaccount.com").build();StorageObject storageObject = new StorageObject();storageObject.setBucket(bucket);InputStream fileUploadStream = new FileInputStream(videoFile);try {InputStreamContent content = new InputStreamContent("video/mp4", fileUploadStream);Storage.Objects.Insert insert = storage.objects().insert(bucket, null, content);insert.setName(cloudStoragePath);insert.execute();} finally {fileUploadStream.close();}
0 件のコメント :
コメントを投稿