Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of Owncast with MediaCMS for live streaming #763

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

KyleMaas
Copy link
Contributor

Description

Integration of Owncast with MediaCMS. After running this now for several months, there's more I'd like to add but I feel it's stable enough for primetime.

Setup for this is really simple. This operates using two new settings which can be added to local_settings.py:

LIVESTREAM_BACKEND -> Set to "owncast" to enable the live stream functionality. This leaves open the possibility (which I intend to use in the future) of tying into alternative live streaming platforms.
LIVESTREAM_URI -> Set to the base address of your Owncast installation, e.g. "https://live.example.com/"

When enabled, it adds an item to the left nav bar called "Live", and if it's able to successfully connect to Owncast and query its status, it will change to "Live (Offline)" or "Live (Online)" depending on the very resource-minimal Owncast status API, which then gets queried once per minute from the client end so people can watch right away when a stream goes live. If the stream is live when the homepage is loaded, it also shows the live stream at the top with a thumbnail and count of current viewers, again using the information queried from Owncast.

Eventually I'd love to have the left nav bar item open in a new window. But that's really about the only thing I'm not 100% satisfied with about the way this has been working for me.

Steps

Pre-deploy

Post-deploy

@mgogoulos
Copy link
Contributor

Thanks a lot for the PR! Would it be possible to share a screenshot, or even include a section on the documentation?

@KyleMaas
Copy link
Contributor Author

KyleMaas commented May 8, 2023

Not sure how to resolve that conflict, but I added documentation as to how to use this. Due to the project this is being used on, I cannot include a screenshot. Hopefully that's enough to explain how it works. Feel free to change as needed to resolve the conflict.

@morbificagent
Copy link

Hi together,
i love the idea of being able to integrate owncast here...
Im not very common in Github pull request coding things ;-) but why isnt this implemented yet, as for me as a "no-coder" it looks like a complete code from @KyleMaas which could be used for this...

@morbificagent
Copy link

OK, have tried to make the same changes as you showed in your 3 commits above but nothing has changed on my site... Do i have to do something more as make the same changes?

Many thanks for your help!

@morbificagent
Copy link

Update:

Made it... and i love it:

image

After replicating your changes this was necessary to rebuild the frontend:

apt update
apt upgrade -y
apt install npm -y

cd /home/mediacms.io/mediacms/frontend
npm install
npm run dist
cp -rf /home/mediacms.io/mediacms/frontend/dist/static /home/mediacms.io/mediacms/

@KyleMaas
Copy link
Contributor Author

@morbificagent

Awesome! Glad it's working for you. And now we have a screenshot to work with.

@KyleMaas
Copy link
Contributor Author

Attempted fixing merge conflicts

@@ -31,4 +31,6 @@ def stuff(request):
ret["ALLOW_RATINGS_CONFIRMED_EMAIL_ONLY"] = settings.ALLOW_RATINGS_CONFIRMED_EMAIL_ONLY
ret["VIDEO_PLAYER_FEATURED_VIDEO_ON_INDEX_PAGE"] = settings.VIDEO_PLAYER_FEATURED_VIDEO_ON_INDEX_PAGE
ret["RSS_URL"] = "/rss"
ret["LIVESTREAM_BACKEND"] = settings.LIVESTREAM_BACKEND
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're not adding a default value on settings, so this will make the process break with

AttributeError: 'Settings' object has no attribute 'LIVESTREAM_BACKEND'

Better wrap this in a try/except to ensure that it does not break

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in latest commit

@@ -7,7 +7,8 @@ export function ItemsListHandler(
first_item_request_url,
request_url,
itemsCountCallback,
loadItemsCallback
loadItemsCallback,
translateCallback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what translateCallback is doing, can you help me explain these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea with this is to keep the frontend as unmodified as possible. The way it does this is by having the OwnCast query's response translated into the same format as the MediaCMS server would normally return for a video item.

@mgogoulos
Copy link
Contributor

I would like to things here before I can merge the PR:

  1. Understand what the changes are doing, and how they work
  2. Make sure that a new (or existing) installation that is NOT using this feature, does not get affected at all.

@mgogoulos
Copy link
Contributor

thanks for the updates, will try to test it out, and mostly ensure about 2. (Make sure that a new (or existing) installation that is NOT using this feature, does not get affected at all.), thanks!

@KyleMaas
Copy link
Contributor Author

I'll note that I'm still running this, and it still works well, even with newer versions of Owncast (0.1.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants