alohartc

package module
v0.0.0-...-b172891 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

README

AlohaRTC

Real-time communication with embedded cameras, natively within the browser

Building

First, download dependencies:

make get

To cross-compile for a Raspberry Pi Model 3B/3B+ (armv7-based architecture):

make

To cross-compile for a Raspberry Pi Zero (armv6-based architecture):

GOARM=6 make

To build for production:

GOFLAGS="-tags=production" make

Quickstart

Build code as above, then transfer alohacam to Raspberry Pi and run. Open http://<target>:8000 in browser. This should start a live video stream from Raspberry Pi.

Notes

Ensure camera is enabled on Raspberry Pi and that v4l2 module is loaded.

Modify /etc/modules as follows:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

bcm2835-v4l2
...

Modify /boot/config.txt as follows:

boot/config.txt
...
start_x=1
gpu_mem=128

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LocalAudio media.AudioSource
	LocalVideo media.VideoSource
}

type PeerConnection

type PeerConnection struct {

	// RTP payload type (negotiated via SDP)
	DynamicType uint8

	// Callback when a local ICE candidate is available.
	OnIceCandidate func(*ice.Candidate)
	// contains filtered or unexported fields
}

func Must

func Must(pc *PeerConnection, err error) *PeerConnection

Must is a helper that wraps a call to a function returning (*PeerConnection, error) and panics if the error is non-nil. It is intended for use in variable initializations such as

var pc = alohartc.Must(alohartc.NewPeerConnection(config))

func NewPeerConnection

func NewPeerConnection(config Config) (*PeerConnection, error)

NewPeerConnection creates a new peer connection object

func NewPeerConnectionWithContext

func NewPeerConnectionWithContext(ctx context.Context, config Config) (*PeerConnection, error)

NewPeerConnectionWithContext creates a new peer connection object

func (*PeerConnection) AddIceCandidate

func (pc *PeerConnection) AddIceCandidate(c *ice.Candidate)

AddIceCandidate adds a remote ICE candidate.

func (*PeerConnection) Close

func (pc *PeerConnection) Close()

Close the peer connection

func (*PeerConnection) SetRemoteDescription

func (pc *PeerConnection) SetRemoteDescription(sdpOffer string) (sdpAnswer string, err error)

Set remote SDP offer. Return SDP answer.

func (*PeerConnection) Stream

func (pc *PeerConnection) Stream() error

Stream establishes a connection to the remote peer, and streams media to/from the configured tracks. Blocks until an error occurs, or until the PeerConnection is closed.

Directories

Path Synopsis
cmd
examples
internal
ice
mux
rtp
sdp
dtls Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL