mediacms-io / mediacms

MediaCMS is a modern, fully featured open source video and media CMS, written in Python/Django and React, featuring a REST API.
https://mediacms.io
GNU Affero General Public License v3.0
2.52k stars 459 forks source link

Linking to a particular time doesn't work #926

Open KyleMaas opened 7 months ago

KyleMaas commented 7 months ago

Describe the issue See this discussion:

https://github.com/mediacms-io/mediacms/discussions/319

I've received user complaints and have tried this myself and confirm that it does not work. The UI elements for generating a timed link in the Share button work, but when you actually go to the link it doesn't work.

To Reproduce Steps to reproduce the issue:

  1. Go to a video
  2. Skip partway through the video
  3. Click Share
  4. Check the "Start at XX:XX" checkbox and copy the link
  5. Paste the link into another tab or browser
  6. Video plays from the start instead of from the time specified

Expected behavior This:

https://github.com/mediacms-io/mediacms/blob/main/docs/user_docs.md#using-timestamps-for-sharing

Environment (please complete the following information):

KyleMaas commented 7 months ago

I'm not even sure how this is possible, but setting breakpoints in the code, this entire function seems to not be running:

https://github.com/mediacms-io/mediacms/blob/c5047d8df8686d75100e5099489be4fd1bf5f733/frontend/src/static/js/components/video-player/VideoPlayer.jsx#L95

KyleMaas commented 7 months ago

Sorry, wrong function. That one doesn't seem to be running, either, but this one is the more problematic one that's not running:

https://github.com/mediacms-io/mediacms/blob/c5047d8df8686d75100e5099489be4fd1bf5f733/frontend/src/static/js/components/video-player/VideoPlayer.jsx#L187

KyleMaas commented 7 months ago

Nevermind. The compiled code is duplicated in two different places, and I was looking at the wrong one.

KyleMaas commented 7 months ago

So it is running, and it's reaching this within Video.js:

https://github.com/videojs/video.js/blob/3c110f0fb10961791c8b55025e8f9f4a15607306/src/js/player.js#L2510

But the problem seems to be that this happens before Video.js is finished initializing, so then this fires within Video.js:

https://github.com/videojs/video.js/blob/3c110f0fb10961791c8b55025e8f9f4a15607306/src/js/player.js#L2524

Which, because of the first call and the fact that the Video.js frontend thought it was ready and it cleared the cache init time, the second call sets the seek position to the start.

KyleMaas commented 7 months ago

https://github.com/videojs/video.js/issues/3495

KyleMaas commented 7 months ago

https://github.com/videojs/video.js/issues/1324

KyleMaas commented 6 months ago

Did you recompile the frontend and install it after applying this? This change does not include a compiled version - doing that results in too many merge conflicts.

Also, what browser did you try it in?

On December 25, 2023 2:51:27 AM EST, "Сергей Б." @.***> wrote:

videojs/video.js#1324

I have the same problem. Unfortunately, your fix doesn't work for me.

-- Reply to this email directly or view it on GitHub: https://github.com/mediacms-io/mediacms/issues/926#issuecomment-1868830600 You are receiving this because you authored the thread.

Message ID: @.***>

segurancadecomputadores commented 2 months ago

Even with this modification, this feature not work... i am using firefox as client. The server is Ubuntu 22, with this version:

https://github.com/KyleMaas/mediacms.git

KyleMaas commented 1 month ago

@segurancadecomputadores That version doesn't contain the fix. You would need to use the code from this branch:

https://github.com/KyleMaas/mediacms/tree/fix-timed-links

But it still will not work until you rebuild the frontend. To make it easy to merge back into the project without conflicts, that branch only contains the changes to the source code for the frontend but does not contain the built files. To test it out, you would need to go into the frontend folder and npm build dist IIRC and then copy the built files from frontend/dist into static. It's not designed for direct use but for merging into the main project so that everyone can use it, so trying it out is a little more involved.