stream.go 761 B

12345678910111213141516171819202122232425262728
  1. package webhooks
  2. import (
  3. "time"
  4. "github.com/owncast/owncast/core/data"
  5. "github.com/owncast/owncast/models"
  6. "github.com/teris-io/shortid"
  7. )
  8. // SendStreamStatusEvent will send all webhook destinations the current stream status.
  9. func SendStreamStatusEvent(eventType models.EventType) {
  10. sendStreamStatusEvent(eventType, shortid.MustGenerate(), time.Now())
  11. }
  12. func sendStreamStatusEvent(eventType models.EventType, id string, timestamp time.Time) {
  13. SendEventToWebhooks(WebhookEvent{
  14. Type: eventType,
  15. EventData: map[string]interface{}{
  16. "id": id,
  17. "name": data.GetServerName(),
  18. "summary": data.GetServerSummary(),
  19. "streamTitle": data.GetStreamTitle(),
  20. "status": getStatus(),
  21. "timestamp": timestamp,
  22. },
  23. })
  24. }