Peertube: Is it possible to modify the video player using some methods?

Created on 13 Jun 2020  路  1Comment  路  Source: Chocobozzz/PeerTube

In a word: Is it possible to add new features to the video player using plugins? If not, is it possible to modify the source code to meet the need?
Also, please forgive my poor English :)


Background

(To make the issue shorter I'm hiding this section.)

I've dreamed about building a ACG-centered PeerTube instance in replacement of the popular video site "niconico" (in Japan), "acfun" and "Bilibili" (both in China). (BTW, the word "ACG" stands for Anime, Comic and Gaming.)

As an ACG culture, "danmaku" (or the boring English name "Bullet Chatting") is widely used throughout these websites. It's a technology that displays users' comments realtime in the player while the video is playing. It even became a W3C Proposal, with the help of Bilibili and Migu.

When I thought of building a video site, I thought of PeerTube. Great! But it lacks the "danmaku". However, I did find a nice danmaku HTML5 player called DPlayer. But it seems that it's not possible to replace PeerTube's player..

Well, let's return to the issue itself.

Considered Solutions

1. Replace the player directly + Using a plugin

Well, that seems impossible. Though in my case, the player does support WebTorrent and lots of other streaming formarts.
And... Even if a custom player is used, how can it save extra data (like danmakus)? Obviously a plugin must be used. Too complicated!

2. Only using a plugin

Yeah it sounds good! But is it possible? I've found some themes and plugins, none of which modifies the player. Do plugins have the power to modify the player's components (and in my case, modify the database to save the danmakus)?

3. Modify the source code.

Okay it can do anything, but it's the last solution. Where should I (or other developers) start reading the source code? Can the modified PeerTube still connect with each other?


Well I admit that I've written a lot, and I'm extremely sorry if I'm taking up your time! If you just want a one-line explainer, here I'm copying Line 1:

Is it possible to add new features to the video player using plugins? If not, is it possible to modify the source code to meet the need?

P.S. Though I'm submitting this issue, I don't plan to do anything with the code, since my Javascript/Typescript skill is limited. Just dreaming about things, however, costs nothing. 馃樄

Question

Most helpful comment

hi @ZeroAurora,

I'd advise against replacing the player, as we rely on the videojs plugin system to add some features of our own in it as well. You would be much better off writing/reusing a videojs plugin like https://github.com/SunnyLi/videojs-danmaku and injecting it via a PeerTube plugin in the watch page - a feat that is demonstrated by plugins such as https://framagit.org/rigelk/peertube-plugin-slides/ or https://framagit.org/rigelk/peertube-plugin-koukoku.

Comments of a danmaku need to be stored somewhere - and there, you would need to plug it with a third-party service to comment/moderate comments.

As for modifying PeerTube, I would see one advantage of doing so: add a way to load comments so that you get a special list of those meant for the danmaku (those beginning with a timestamp and under a certain size, or any other special set of characters that differentiates it) that is loaded for the embed as well.

P.S.: your english is crystal clear, and not everyone is a native speaker on this tracker anyway :wink:

>All comments

hi @ZeroAurora,

I'd advise against replacing the player, as we rely on the videojs plugin system to add some features of our own in it as well. You would be much better off writing/reusing a videojs plugin like https://github.com/SunnyLi/videojs-danmaku and injecting it via a PeerTube plugin in the watch page - a feat that is demonstrated by plugins such as https://framagit.org/rigelk/peertube-plugin-slides/ or https://framagit.org/rigelk/peertube-plugin-koukoku.

Comments of a danmaku need to be stored somewhere - and there, you would need to plug it with a third-party service to comment/moderate comments.

As for modifying PeerTube, I would see one advantage of doing so: add a way to load comments so that you get a special list of those meant for the danmaku (those beginning with a timestamp and under a certain size, or any other special set of characters that differentiates it) that is loaded for the embed as well.

P.S.: your english is crystal clear, and not everyone is a native speaker on this tracker anyway :wink:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ufm picture ufm  路  3Comments

MikaXII picture MikaXII  路  3Comments

ChameleonScales picture ChameleonScales  路  3Comments

filmaidykai picture filmaidykai  路  3Comments

tcitworld picture tcitworld  路  3Comments