Skip to content
Snippets Groups Projects

add hotkey to reload current media file

Open Zyad Ayad requested to merge zyad-ayad/vlc:add-reload-hotkey into master
2 unresolved threads

Added a reload media hotkey to reload the current file, so any changes are reflected.

related issue: #28946

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
279 279 case ACTIONID_FRAME_NEXT:
280 280 vlc_player_NextVideoFrame(player);
281 281 break;
282 case ACTIONID_RELOAD_MEDIA:
283 {
284 vlc_player_t *player = vlc_playlist_GetPlayer(intf->p_sys->playlist);
285 input_item_t *current_media = vlc_player_GetCurrentMedia(player);
286
287 if (current_media)
288 {
289 char *uri = input_item_GetURI(current_media);
  • This is of course wrong as it drops everything other than the URI.

  • at #28946 the hotkey is required to "reload a video is a very useful feature that can make life easier for people who create subtitles or work with tools that frequently modify the video."

    So what I tried to do is simply reload everything again to see changes, it's like stopping the media to start it again.

    The code can be reduced btw.

  • Please register or sign in to reply
  • 280 280 vlc_player_NextVideoFrame(player);
    281 281 break;
    282 case ACTIONID_RELOAD_MEDIA:
    283 {
    284 vlc_player_t *player = vlc_playlist_GetPlayer(intf->p_sys->playlist);
    285 input_item_t *current_media = vlc_player_GetCurrentMedia(player);
    286
    287 if (current_media)
    288 {
    289 char *uri = input_item_GetURI(current_media);
    290 if (uri)
    291 {
    292 input_item_t *new_media = input_item_New(uri, NULL);
    293 if (new_media)
    294 {
    295 vlc_player_Stop(player);
    • This is harmful. We don't want to reset all resources just to (effectively) seek to zero.

      TBH, I don't see the point in adding a hotkey at all.

    • I understand your points. my idea was not to restart but to reload the media for example, if subtitles change or the file itself updates while playing.

      The hotkey is not very important, but it's required. so why not?

    • Zyad Ayad changed this line in version 5 of the diff

      changed this line in version 5 of the diff

    • Stating the obvious here, but VLC doesn't cache whole files in memory. If you change the file and seek to the beginning, you get the updated content.

      Though at least on Windows, this will never work due to implicit file locking, so the hotkey is pretty helpless there anyway. Potentially other OSes too depending on the underlying file system.

      But that's not the point. The point is that you should not stop/start the player or change input item.

    • Please register or sign in to reply
  • Zyad Ayad added 1 commit

    added 1 commit

    Compare with previous version

  • Zyad Ayad added 13 commits

    added 13 commits

    Compare with previous version

  • @zyad-ayad please don't rebase against master. we do that for you once this merge request is accepted.

  • Please register or sign in to reply
    Loading