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

Support playing External videos #127

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

amguirado73
Copy link

@amguirado73 amguirado73 commented Aug 20, 2021

This PR gives the ability to playback external videos (youtube, mp4, ...).

It reproduces events generated in a meeting (start/stop/playbackrate). It need a xml file similar to:

https://negra.f-integra.org/external_videos.xml

Now, bbb is not able to generate this type of file but it may be adapted. I have generated this file changing bbb-html5 and include logs with external video redis messages. File shapes.svg must also be modified.

Besides events generated in meeting, this PR also lets control external video with primary controls. So if yoy start/stop/change rate or volume, the external video change.

It has been only tested with youtube and mp4 files.

You can test it in:
https://bbbdemo23.f-integra.org/playback/presentation/2.3/1facfc84a74fb0957f2f1ceb4760a984925bc61b-1629192064279

Copy link
Contributor

@hiroshisuga hiroshisuga left a comment

Choose a reason for hiding this comment

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

It worked well in my place, after adding some more codes (please look at my review comments). Without these modifications, the external video does not start after appearing.

}

orchestrator () {
const { events, active, primaryPlaybackRate } = this.props;
Copy link
Contributor

@hiroshisuga hiroshisuga Aug 22, 2021

Choose a reason for hiding this comment

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

We need to import a timestamp update function here.
const {getCurrentPlayerTime } = this.props;

const { playing, playbackRate } = this.state;

let primaryPlayerPlaying = true;

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to me this.time has to be updated here, otherwise it stays always zero.

this.time = getCurrentPlayerTime();

}

Copy link
Contributor

@hiroshisuga hiroshisuga Aug 22, 2021

Choose a reason for hiding this comment

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

We can probably create a function to obtain the time stamp here.
getCurrentPlayerTime() {
const { time } = this.state;
return time;
}

And this function should be registered at the constructor like:
this.getCurrentPlayerTime = this.getCurrentPlayerTime.bind(this);

videoUrl={url}
onPlayerReady={this.handlePlayerReady}
events={events}
primaryPlaybackRate={primaryPlaybackRate}
Copy link
Contributor

@hiroshisuga hiroshisuga Aug 22, 2021

Choose a reason for hiding this comment

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

export the function to the component.
getCurrentPlayerTime={this.getCurrentPlayerTime}

@amguirado73
Copy link
Author

amguirado73 commented Aug 22, 2021 via email

@amguirado73
Copy link
Author

amguirado73 commented Aug 22, 2021 via email

@hiroshisuga
Copy link
Contributor

hiroshisuga commented Aug 22, 2021

Hi @amguirado73, thanks for the reply.

I am neither a professional programmer (not even a computer person) and not sure at all if my modification makes sense. The facts are:

  1. I know that this.time is updated in your demo. Working amazingly.
  2. But when I locally implemented your code (I also created the external_videos.xml manually but not shapes.svg which seems not essential for external video) in my server, this.time had never been updated. Thus, the external video appeared in the playback screen but never started.
  3. Looking at the code, I found that this.time is not changed anywhere in src/components/external-video-player/index.js (staying zero). As this.time is a constructor variable, it has to be modified within src/components/external-video-player/index.js (if I am not terribly wrong..). Thus I tried to get the player's time from src/components/player.js.
  4. After these modifications, this.time started to be updated and the external videos are played back very well.

So, I still don't know if I am doing something wrong, or least likely, your PR does not contain every modification that you applied in your demo. @pedrobmarin will tell us something.

Last but not least, I am very grateful with your PR. This has been very awaited function in the community. I've heard that it's technically difficult but your PR seems to have solved the issue. I cannot believe you are not professional;-) We will see if somebody changes the BBB's side.

@amguirado73
Copy link
Author

amguirado73 commented Aug 22, 2021 via email

@hiroshisuga
Copy link
Contributor

hiroshisuga commented Aug 23, 2021

Would it be possible to show the control bar on the YouTube panel? Currently changing the sound volume is not possible in YouTube and we cannot hear the presenter when the YouTube video is played with a large sound.

@amguirado73
Copy link
Author

amguirado73 commented Aug 23, 2021 via email

@hiroshisuga
Copy link
Contributor

Great! Setting this value to 1 (with autohide option on) seems to be a good default setting to me.

@pedrobmarin pedrobmarin changed the base branch from master to develop September 4, 2021 11:16
@amguirado73
Copy link
Author

amguirado73 commented Sep 7, 2021 via email

@pedrobmarin
Copy link
Collaborator

Hi @amguirado73 ,

From what I saw and experieced I think this is going to the correct direction. Yet, there are several points that I would do different:

  • I'd rather use a json data file than an xml. Having to parse, deconstruct and rebuild it's not ideal;
  • using the medias' synchronizer to handle volume sync may not be the best choice because we only use this structure when there are multiple medias to play (webcams and screenshare);
  • as we already ship a simple version of external videos (that only adds a chat message) we'll have to be extra careful to avoid breaking the recordings for those who already publish them with it;
  • I think we will need to check if the external video is available before playing it. Not sure what could happen if, for instance, the video was removed from the source and we keep trying to sync it;
  • The live session allows external videos from other sources. We would have to check on those too;
  • We are still missing the recording process scripts (the ones that will build de external_video.xml/json file)

Anyway, just points to have in mind. You don't have to feel obligated to achieve all of them, I'll try to help with some of those.

Thanks a lot for this initial work!

@amguirado73
Copy link
Author

amguirado73 commented Sep 7, 2021 via email

@amguirado73
Copy link
Author

amguirado73 commented Sep 8, 2021 via email

@hiroshisuga
Copy link
Contributor

Hi @amguirado73 , I have found that this PR is outdated due to the massive refactoring done in the version 3 player.

Would you by chance consider to refactor this PR as well so that it works on the version 3 player?

I am actually using your PR on the 2.3.4 player, typing manually the xml file. Students like it very much. I hope I continue to use it in the latest player.

@amguirado73
Copy link
Author

amguirado73 commented Jan 17, 2022 via email

@fvlasie
Copy link

fvlasie commented Jun 29, 2022

Very exciting work! Thank you!
Could there be an option to have BBB download the video file and save it locally with the other recording data?
Links go stale and sometimes external connections are not good...

@GuiLeme
Copy link
Contributor

GuiLeme commented Jul 20, 2023

Hey guys! @amguirado73, could you please merge the develop branch onto yours? So that I can follow through with the review! Thanks for the contribution!!

@hiroshisuga
Copy link
Contributor

Hi @GuiLeme , I have my own branch based on the one from @amguirado73 . It's working but still needs some (or a lot of) refactoring, as the implementation is old fashioned and not elegant. I made it just quickly for my students which need that function right now. If you are interested, I can post it as PR.

@GuiLeme
Copy link
Contributor

GuiLeme commented Jul 21, 2023

@hiroshisuga, yeah, that would be great!! Let's just wait for a few days, maybe, and if @amguirado73 don't respond back, we follow through with your PR, and tag this PR for credits! What do you say?

@hiroshisuga
Copy link
Contributor

@GuiLeme , whatever is just fine for me.

@amguirado73
Copy link
Author

Hello,

Sorry for the delay in answering. My availability to update the code is very limited. Maybe in September I can have some time but I can't guarantee it.

Regards

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.

5 participants