/** * Get the List of Videos from Video Service. * * @return the List of Videos from Server or null if there is failure in getting the Videos. */ public List<Video> getVideoList() { try { return (ArrayList<Video>) mVideoServiceProxy.getVideoList(); } catch (Exception e) { return null; } }
/** * Uploads the Video having the given Id. This Id is the Id of Video in Android Video Content * Provider. * * @param videoId Id of the Video to be uploaded. * @return A String indicating the status of the video upload operation. */ public String uploadVideo(Context context, Uri videoUri) { // Get the path of video file from videoUri. String filePath = VideoMediaStoreUtils.getPath(context, videoUri); // Get the Video from Android Video Content Provider having // the given filePath. Video androidVideo = VideoMediaStoreUtils.getVideo(context, filePath); // Check if any such Video exists in Android Video Content // Provider. if (androidVideo != null) { // Prepare to Upload the Video data. // Create an instance of the file to upload. File videoFile = new File(filePath); // Check if the file size is less than the size of the // video that can be uploaded to the server. if (videoFile.length() < Constants.MAX_SIZE_MEGA_BYTE) { try { // Add the metadata of the Video to the Video Service // and get the resulting Video that contains // additional meta-data (e.g., Id and ContentType) // generated by the Video Service. Video receivedVideo = mVideoServiceProxy.addVideo(androidVideo); // Check if the Server returns any Video metadata. if (receivedVideo != null) { return STATUS_UPLOAD_SUCCESSFUL; // // Finally, upload the Video data to the server // // and get the status of the uploaded video data. // VideoStatus status = // mVideoServiceProxy.setVideoData // (receivedVideo.getId(), // new TypedFile(receivedVideo.getContentType(), // videoFile)); // // // Check if the Status of the Video or not. // if (status.getState() == VideoState.READY) { // // Video successfully uploaded. // return STATUS_UPLOAD_SUCCESSFUL; // } } } catch (Exception e) { // Error occured while uploading the video. return STATUS_UPLOAD_ERROR; } } else // Video can't be uploaded due to large video size. return STATUS_UPLOAD_ERROR_FILE_TOO_LARGE; } // Error occured while uploading the video. return STATUS_UPLOAD_ERROR; }
public Collection<String> getUsersWhoLikedVideo(long id) { return mVideoServiceProxy.getUsersWhoLikedVideo(id); }
public void unlikeVideo(long id) { mVideoServiceProxy.unlikeVideo(id); }
public Video getVideo(long id) { return mVideoServiceProxy.getVideoById(id); }