package com.ryong21.example.publisher;
import java.io.File;
import java.io.IOException;
import org.red5.server.messaging.IMessage;
import org.red5.server.stream.message.RTMPMessage;
import org.red5.server.stream.provider.FileProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Publisher {
public static void main(String[] args) throws IOException, InterruptedException {
Logger log = LoggerFactory.getLogger(Publisher.class);
String publishName = "test";
String localFile = "red5.flv";
String host = "192.168.1.200";
int port = 1935;
String app = "live";
IMessage msg = null;
int timestamp = 0;
int lastTS = 0;
PublishClient client = new PublishClient();
client.setHost(host);
client.setPort(port);
client.setApp(app);
client.start(publishName, "live", null);
while(client.getState() != PublishClient.PUBLISHED){
Thread.sleep(500);
}
FileProvider fp = new FileProvider(new File(localFile));
while(true){
msg = fp.pullMessage(null);
if(msg == null){
log.debug("done!");
break;
}
timestamp = ((RTMPMessage)msg).getBody().getTimestamp();
Thread.sleep((timestamp - lastTS));
lastTS = timestamp;
client.pushMessage( msg);
}
client.stop();
}
}
Saturday, June 18, 2011
Java Code Examples
Subscribe to:
Post Comments (Atom)
thanks for posting this, will test it later
ReplyDeleteHi,
ReplyDeletegetting the below error:
Exception in thread "main" java.lang.SecurityException: class "com.ryong21.example.publisher.PublishClient"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at com.ryong21.example.publisher.Publisher.main(Publisher.java:31)
class "com.ryong21.example.publisher.PublishClient"'s signer information does not match signer information of other classes in the same package
ReplyDelete