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

[WIP] Ptitloup/feature video p2p #925

Draft
wants to merge 73 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
4bdbc70
implement p2p-media-loader : https://github.com/Novage/p2p-media-load…
ptitloup Aug 28, 2023
ce34c8e
add p2p configuration in video script - show p2p stat in video_page_c…
ptitloup Aug 29, 2023
1b15d8f
add minus in stats info
ptitloup Aug 30, 2023
183a1cb
Merge branch 'develop' of https://github.com/EsupPortail/Esup-Pod int…
ptitloup Aug 30, 2023
e781dd7
change npm package to get videojs8 and p2p media loader from peertube…
ptitloup Sep 7, 2023
8c30e02
merge package.json
ptitloup Sep 7, 2023
6d7d0fc
add videojs-hlsjs-plugin.js
ptitloup Sep 7, 2023
74b20c2
workon videojs 8 plugin - ok for logo, quality selector, p2p, remove …
ptitloup Sep 7, 2023
d310993
remove chapter plugin from videojs and use video text track in webvtt…
ptitloup Sep 8, 2023
22f80c8
merge develop - fix conflicts
ptitloup Sep 8, 2023
743e85f
remove chapter from video element and add overview
ptitloup Sep 8, 2023
a4c081e
fix get element by id for playlist
ptitloup Sep 8, 2023
810ab24
remove plugin to show info in modal and use videojs api modal plyaer …
ptitloup Sep 8, 2023
56337bf
add settgins for the p2p function and improve display of p2p stats
ptitloup Sep 8, 2023
319ff1d
add jsdoc and readme - add p2p js only if p2p feature is activated - …
ptitloup Sep 11, 2023
9b23773
Merge branch 'develop' of https://github.com/EsupPortail/Esup-Pod int…
ptitloup Sep 11, 2023
334227f
add video-p2p-stats.js to store all p2p event function - add p2p to l…
ptitloup Sep 11, 2023
ed9a83e
create template to show p2p stats and call it from another template -…
ptitloup Sep 12, 2023
e4dd235
pull develop and remove videojs-info-controlbar.js
ptitloup Sep 12, 2023
5e796af
change firstplay by one play to deal with new videojs8 api - improvin…
ptitloup Sep 12, 2023
c25774d
use default configuration in live script for p2p
ptitloup Sep 13, 2023
c507eb4
replace videojs hlsjs plugin by the original - use the good init func…
ptitloup Sep 18, 2023
31aa5f8
[WIP] Update HLS with hls-plugin (#4)
SebastienCozeDev Oct 12, 2023
d2978ed
Merge develop
SebastienCozeDev Oct 13, 2023
200252c
make lang
SebastienCozeDev Oct 13, 2023
42ad6e3
Fix .mo
SebastienCozeDev Oct 13, 2023
add831d
Add buffer length
SebastienCozeDev Oct 13, 2023
04b935f
Fix conflicts
AymericJak Nov 6, 2023
523e35b
Merge branch 'develop' of https://github.com/EsupPortail/Esup-Pod int…
AymericJak Nov 7, 2023
d2f86ea
Replace deprecated methods & fix viewcounter
AymericJak Nov 7, 2023
4046e4b
Replace deprecated functions & remove redundant import
AymericJak Nov 7, 2023
1e5565b
Improve QoC of event-script.html file
AymericJak Nov 8, 2023
c6b2e57
Add Pod resolutions plugin
AymericJak Nov 8, 2023
add2355
Fix viewcounter import
AymericJak Nov 8, 2023
ab8a71e
Replace deprecated methods & remove imports
AymericJak Nov 9, 2023
a110b0c
Add parameters for video hls js config
AymericJak Nov 9, 2023
945079f
Pull develop
AymericJak Nov 9, 2023
93aff4c
QoC - Part 1
AymericJak Nov 10, 2023
10f50fb
QoC - Part 2 - hls-plugin
AymericJak Nov 10, 2023
ec8d234
QoC - Part 3
AymericJak Nov 10, 2023
4adad31
Fix chapters
AymericJak Nov 10, 2023
f12eaad
Fix conflicts
AymericJak Nov 20, 2023
5c6e4e6
Create the peer to peer application & the USE_PEER_TO_PEER setting
SebastienCozeDev Dec 12, 2023
fdc41ca
Add test
SebastienCozeDev Dec 12, 2023
618881a
Add test
SebastienCozeDev Dec 13, 2023
df56953
Resolve request bug
SebastienCozeDev Dec 14, 2023
82c8b5a
Rename functions
SebastienCozeDev Dec 14, 2023
9152e09
Add getIds function
SebastienCozeDev Dec 14, 2023
917a6fd
Update the getIds() function
SebastienCozeDev Dec 14, 2023
e6299fe
Fix peerID
AymericJak Dec 14, 2023
1189eff
Merge branch 'ptitloup/feature_video_p2p' of https://github.com/ptitl…
AymericJak Dec 14, 2023
4eb2da2
Fix storeUrlsId
AymericJak Dec 14, 2023
46e7d46
Rename videoId
AymericJak Dec 14, 2023
453a8d5
Update p2p-script.js
SebastienCozeDev Dec 14, 2023
61b14b8
Merge branch 'ptitloup/feature_video_p2p' of https://github.com/ptitl…
SebastienCozeDev Dec 14, 2023
cfcf1e3
Linting & doc
AymericJak Dec 14, 2023
2774bfb
Fix conflicts
AymericJak Dec 14, 2023
853b733
Merge branch 'develop' of https://github.com/EsupPortail/Esup-Pod int…
AymericJak Dec 14, 2023
929e018
Add connection to an other peer
SebastienCozeDev Dec 14, 2023
113d0b7
Merge develop
SebastienCozeDev Dec 14, 2023
3ac24e1
Add connectToAnyPeers
SebastienCozeDev Dec 15, 2023
56e73b4
Add clear invalid peer from caches view
AymericJak Dec 15, 2023
04359c1
Merge branch 'ptitloup/feature_video_p2p' of https://github.com/ptitl…
AymericJak Dec 15, 2023
83c5ad0
Update caches
AymericJak Dec 15, 2023
485cc75
Add connectToAnyPeers and connectToNextPeer function (not work)
SebastienCozeDev Dec 15, 2023
91ff5a2
Add beforeRequest redefine
SebastienCozeDev Dec 15, 2023
cb6688b
Add the P2p object
SebastienCozeDev Dec 15, 2023
ebc3520
Increase timeout for caches
AymericJak Dec 15, 2023
ee7944b
Fix conflicts
AymericJak Jan 4, 2024
5b37864
Manage peers in caches
AymericJak Jan 5, 2024
c6d6bf1
- Add & update documentation
SebastienCozeDev Jan 5, 2024
0193cee
Add the numberofConnections var
SebastienCozeDev Jan 16, 2024
7bbea0f
Merge develop
SebastienCozeDev Jan 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 38 additions & 13 deletions pod/chapter/static/js/videojs-chapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,28 @@
* Initialize the plugin.
*/
var Plugin = videojs.getPlugin("plugin");

/**
* Custom Video.js plugin for handling chapters in a video player.
*
* @class podVideoJsChapters
* @extends {Plugin}
* @param {Object} player - The Video.js player instance.
* @param {Object} options - Configuration options for the plugin.
*/
class podVideoJsChapters extends Plugin {
constructor(player, options) {
super(player, options);
var settings = videojs.mergeOptions(defaults, options),
var settings = videojs.obj.merge(defaults, options),
chapters = {},
currentChapter = document.createElement("li");

/**
* Create the list of chapters
* Create the list of chapters.
*
* @memberof podVideoJsChapters
* @param {Array} data - Chapter data to be displayed.
* @returns {boolean} - Returns false if no chapter data is provided.
*/
player.createChapters = function (data) {
if (!data) {
Expand Down Expand Up @@ -95,20 +108,14 @@
false,
);
}
/* What is the purpose of this code ??
var oldList = document.getElementById("chapters");
var newList = document.getElementsByClassName(
"chapters-list inactive"
);
oldList.parentNode.removeChild(oldList);

let podPlayer = document.getElementById(player.id());
podPlayer.append(newList);
**/
};

/**
* Return a list of chapters useable by other functions
* Return a list of chapters usable by other functions.
*
* @memberof podVideoJsChapters
* @param {Array} data - Chapter data to be grouped.
* @returns {Object} - Object containing arrays of chapter information.
*/
function groupedChapters(data) {
var chapters = {
Expand All @@ -124,10 +131,23 @@
return chapters;
}

/**
* Get the grouped chapters.
*
* @memberof podVideoJsChapters
* @returns {Object} - Object containing arrays of chapter information.
*/
player.getGroupedChapters = function () {
return this.chapters;
};

/**
* Update the current chapter based on the current time.
*
* @memberof podVideoJsChapters
* @param {number} time - Current time in seconds.
* @param {Object} chapters - Object containing arrays of chapter information.
*/
player.getCurrentChapter = function (time, chapters) {
const currentTime = Math.floor(time);

Expand All @@ -145,6 +165,11 @@
}
};

/**
* Main function for initializing the plugin.
*
* @memberof podVideoJsChapters
*/
player.main = function () {
var data = document.querySelectorAll("#chapters li");
if (
Expand Down
1 change: 0 additions & 1 deletion pod/chapter/templates/video_chapter.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{% block page_title %}{% trans 'Chapter video' %} "{{video.title}}" {% endblock page_title %}
{% block page_extra_head %}
{% include 'videos/video-header.html' %}
<script src="{% static 'js/chapters.js' %}?ver={{VERSION}}"></script>
<script>
const video_duration = {{ video.duration }};
</script>
Expand Down
2 changes: 1 addition & 1 deletion pod/enrichment/static/js/videojs-slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ const onPlayerReady = function (player, options) {
*/
const slides = function (options) {
this.ready(function () {
onPlayerReady(this, videojs.mergeOptions(slides_defaults, options));
onPlayerReady(this, videojs.obj.merge(slides_defaults, options));
});
};

Expand Down
9 changes: 7 additions & 2 deletions pod/live/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,13 @@ def is_past(self):
else:
return False

def is_coming(self):
"""Test if event will happen in future."""
def is_coming(self) -> bool:
"""
Chack if event will happen in future.

Returns:
bool: `True` if the event is scheduled to happen in the future, otherwise `False`.
"""
if self.start_date:
return timezone.localtime(timezone.now()) < self.start_date
else:
Expand Down
2 changes: 1 addition & 1 deletion pod/live/static/js/viewcounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ document.addEventListener("DOMContentLoaded", function () {

// Initialize the plugin
videoJsViewerCount = function (options) {
const settings = videojs.mergeOptions(defaults, options),
const settings = videojs.obj.merge(defaults, options),
player = this;
player.ready(function () {
if (settings.ui) {
Expand Down
2 changes: 1 addition & 1 deletion pod/live/templates/live/direct.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ <h2 class="card-title pod-card__title h4">
}

// Management of the end of the stream (for Firefox, Chrome... not working for Edge, Safari)
videojs.Hls.xhr.beforeRequest = function(options) {
videojs.Hls.xhr.onRequest = function(options) {
// Reset counter if video state is ok
if (started && player.readyState() > 2) { nbLoop = 0; }
if (started && player.readyState() <= 2) {
Expand Down
1 change: 0 additions & 1 deletion pod/live/templates/live/event-iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ <h2 class="video-title">{{ event.title }}</h2>

{# affichage du bouton d'info sur le player #}
{% if event.is_coming and event.video_on_hold.is_video or event.is_current %}

<script>
{% if event.is_coming and event.video_on_hold.is_video %}
iframeplayer = videojs("podvideoonholdplayer");
Expand Down
Loading
Loading