Ejemplo n.º 1
0
func injectStreamMetadata(pipe chan error, liveEvent *liveevents.LiveEvent, cp interface{}) {
	var err error

	defer func() {
		pipe <- err
	}()

	body, err := xml.Marshal(cp)
	if err != nil {
		return
	}

	body = append([]byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"), body...)

	req, err := liveEvent.Elemental.GenerateRequest("POST", path.Join(liveEvent.Path, "stream_metadata"), body)
	if err != nil {
		return
	}

	_, _, err = elementals.ExecuteRequest(req)
	if err != nil {
		return
	}

	log.Println("Successfully injected cuepoint into event:", liveEvent.Name)

}
Ejemplo n.º 2
0
func Fetch(elementalServer *elementals.ElementalServer) ([]byte, error) {
	req, err := elementalServer.GenerateRequest("GET", liveEventsPath, nil)
	if err != nil {
		return nil, err
	}

	_, body, err := elementals.ExecuteRequest(req)
	if err != nil {
		return nil, err
	}

	return body, nil
}
Ejemplo n.º 3
0
func injectTimedMetadata(pipe chan error, liveEvent *liveevents.LiveEvent, tm *TimedMetadata) {
	var err error

	defer func() {
		pipe <- err
	}()

	body := []byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<timed_metadata>" + "<id3 encoding=\"base64\">" + generateId3(tm.Title, tm.Subtitle) + "</id3>" + "<cancel>false</cancel>" + "</timed_metadata>")

	req, err := liveEvent.Elemental.GenerateRequest("POST", path.Join(liveEvent.Path, "timed_metadata"), body)
	if err != nil {
		return
	}

	_, _, err = elementals.ExecuteRequest(req)
	if err != nil {
		return
	}

	log.Println("Successfully injected timed_metadata cuepoint into event:", liveEvent.Name)
}