谷歌玻璃流媒体视频服务器 [英] Google Glass stream video to server

查看:180
本文介绍了谷歌玻璃流媒体视频服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个应用程序对于谷歌的玻璃,可以传输到一台服务器,并有一个客户端通过Web浏览器查看流。到目前为止,似乎我需要通过RTSP这样做是为了一个媒体服务器,如Wowza,然后有一个Web服务器托管一些视频播放器,观看RTMP流,但我没有多少运气。

I'm trying to build an app for Google Glass that can stream to a server and have a client view the stream via a web browser. So far it seems I need to do this via RTSP to a media server such as Wowza and then have a web server hosting some video player that views the RTMP stream but I'm not having much luck.

使用libstreaming( https://github.com/fyhertz/libstreaming )我从来没有能够以查看流

Using libstreaming (https://github.com/fyhertz/libstreaming) I'm never able to view the stream.

我也有兴趣做一些与实现WebRTC,这样我可以作出类似环聊一个解决方案,但我不能肯定支持这一尚未有任何库。

I also would be interested in doing something with WebRTC so that I could make a solution similar to Hangouts but am not sure there is any libraries that support this yet.

任何帮助是AP preciated。

Any help is appreciated.

推荐答案

1月份以来, libsreaming 已得到修复,工作在玻璃。它的RTSP视频可以很容易地在VLC播放器或插件来查看。低于code不包括自动生成的存根。

Since January, libsreaming has been fixed to work on Glass. Its RTSP video can easily be viewed in VLC player or plugin. Code below does not include the auto-generated stubs.

public class MainActivity extends Activity implements SurfaceHolder.Callback, Session.Callback {

private int mRtspPort = -1;

private ServiceConnection mRtspServerConnection = new ServiceConnection() {

    private static final int RTSP_PORT = 1234;

    @Override
    public void onServiceConnected(ComponentName className, IBinder binder) {
        RtspServer s = ((RtspServer.LocalBinder) binder).getService();
        s.setPort(RTSP_PORT);
        mRtspPort = s.getPort();
    }
  };

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_main);

    // Configures the SessionBuilder
    SessionBuilder.getInstance()
            .setSurfaceView((SurfaceView) findViewById(R.id.surface))
            .setCallback(this)
            .setPreviewOrientation(90)
            .setContext(getApplicationContext())
            .setAudioEncoder(SessionBuilder.AUDIO_NONE)
            .setVideoEncoder(SessionBuilder.VIDEO_H264)
            .setVideoQuality(new VideoQuality(320, 240, 20, 500000));

    // Starts the RTSP server
    bindService(new Intent(this, RtspServer.class), mRtspServerConnection, Context.BIND_AUTO_CREATE);
}

@Override
public void onResume() {
    super.onResume();
    mResumed = true;
    displayConnectString();
    SessionBuilder.getInstance().getSurfaceView().setAspectRatioMode(SurfaceView.ASPECT_RATIO_PREVIEW);
    SessionBuilder.getInstance().getSurfaceView().getHolder().addCallback(this);
}

private void displayConnectString() {
    WifiManager wifiMgr = (WifiManager) getSystemService(WIFI_SERVICE);
    WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
    int ip = wifiInfo.getIpAddress();
    String ipAddress = Formatter.formatIpAddress(ip);
    ((TextView) findViewById(R.id.connectInfo)).setText("rtsp://" + ipAddress + ":" + mRtspPort);
}

@Override
public void onDestroy() {
    super.onDestroy();
    unbindService(mRtspServerConnection);
}

@Override
public void onSessionStarted() {
    ((TextView) findViewById(R.id.connectInfo)).setText("");
}

@Override
public void onSessionStopped() {
    displayConnectString();
}
}

这篇关于谷歌玻璃流媒体视频服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆