IContext context = new Red5().getContext();
Resource flv = context.getResource("streams/" + stream_id + ".flv");
try {
AWSCredentials credentials = new AWSCredentials(s3AccessKey, s3SecretKey);
S3Service s3 = new RestS3Service(credentials);
S3Bucket bucket = s3.getBucket("xubu");
File file = flv.getFile();
S3Object object = new S3Object(bucket, file);
AccessControlList acl = s3.getBucketAcl(bucket);
object.setAcl(acl);
object.setKey("streams/" + stream_id + ".flv");
object = s3.putObject(bucket, object);
log.info("http://s3.amazonaws.com/" + bucket.getName() + "/" + object.getKey());
file.delete();
return true;
} catch (IOException e) {
log.error(e);
return false;