当屏幕共享应用程序转换为applet

时间:2015-07-11 13:01:35

标签: java red5 japplet

我已将Red5-Screenshare应用程序(在下面的链接中找到)转换为JApplet;

https://code.google.com/p/red5-screenshare/

我刚刚从JApplet扩展了ScreenShare.java类。然后我删除了main()方法并在ScreenShare.java类中放置了以下applet init()方法。

public  void init()
{
    instance = new ScreenShare();


    instance.host = getParameter("host");
    instance.app = getParameter("app");
    instance.port =  Integer.parseInt(getParameter("port"));
    instance.publishName = getParameter("stream");
    instance.codec = getParameter("codec");

    try {
        instance.frameRate = Integer.parseInt(getParameter("framerate"));
        instance.maxWidth = Integer.parseInt(getParameter("width"));
        instance.maxHeight = Integer.parseInt(getParameter("height"));
        logger.debug(instance.maxWidth +","+instance.maxHeight);

    } catch (Exception e) {logger.debug(e.getMessage());}

    System.out.println("User home " + System.getProperty("user.home"));
    System.out.println("User Dir " + System.getProperty("user.dir"));


    logger.debug("host: " + instance.host + ", app: " + instance.app + ", port: " + instance.port + ", publish: " + instance.publishName);

    instance.createWindow();
}

这就是这个applet的JNLP文件的样子

<jnlp href="screenshare_applet.jar">
    <information>
        <title>Red5 ScreenShare</title> 
        <vendor>Dele Olajide</vendor> 
        <homepage>http://code.google.com/p/red5screnshare/</homepage>
        <description>Red5 ScreenShare</description> 
        <description kind='short'>An Open Source Screen Share Java application for Adobe Flash using Red5</description> 
        <offline-allowed/> 
    </information>
    <security>
        <all-permissions/>
    </security> 
    <resources>
        <!-- Application Resources -->
        <j2se version="1.6+" />
        <jar href="screenshare_applet.jar"/>
    </resources>
    <applet-desc 
         name="Red5 ScreenShare"
         main-class='org.redfire.screen.ScreenShare'
         width="500"
         height="440">
        <param name="host" value="localhost"/>
        <param name="app" value="screenshare"/>
        <param name="port" value="1935"/>
        <param name="stream" value="screen_share"/>
        <param name="codec" value="flashsv2"/>
        <param name="framerate" value="15"/>
        <param name="width" value="960"/>
        <param name="height" value="600"/>

     </applet-desc>
</jnlp>

注意:我正在按照此链接上的建议在页面上嵌入JNLP https://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/embeddingJNLPFileInWebPage.html

当我在浏览器中运行JApplet时,屏幕共享流看起来很模糊,如下图所示。但是,当我从eclipse运行相同的JApplet时,流根本不会模糊!

blurred screenstream

知道我做错了吗?

2 个答案:

答案 0 :(得分:1)

现在在scala中提供了BBB中的SessionManager,因此您可以看到方法here的签名并创建一个实现它们的java类。然后将导入更改为您的类,它将构建。

答案 1 :(得分:0)

在将屏幕宽度和高度参数更改为sWidth和sHeight后,我修复了red5-screenhare applet。因为applet将其画布宽度和高度视为屏幕尺寸,导致屏幕捕获模糊。