AntonyCorbett / OnlyM

Simple Media Player (audio, video and images) for use in meetings.
MIT License
182 stars 45 forks source link

Keyboard Controls #46

Open sewru opened 6 years ago

sewru commented 6 years ago

Hi Anthony,

Is it possible to add select, play, stop, pause media with keyboard controls. Currently I see only a way to scroll. With select I mean visibly see that a file is highlighted as the current one.

Thanks.

AntonyCorbett commented 6 years ago

Hi. Thanks for your suggestion. I don't think keyboard control will be very important to the vast majority but let's see me proved wrong :)

sewru commented 6 years ago

Hi Antony Will be looking forward to test it.

Thanks

TizianoNoto commented 6 years ago

Keyboard controls are great for doing things quickly since moving the mouse around usually takes more time. However, in my area "not computer people" operate the desks too and they see anything more advanced than clicking buttons as "thingies for power users".

I'd like to have this included but, since OnlyM's interface is already very simple, I won't complain if nobody else cares.

talkingdragon commented 6 years ago

Hi. This definetly would be useful. I know I made a issue we're I said remote control would be useful as I stand by it. U mentioned you have a letter saying that the speaker can't controll the images. But that must be for UK only. I asked are elders and also the circuit overseer as we just had him and all said we have no such letter (at least in Spain) and no prob for Remote control. Lots here use remote PowerPoint remotes. So having keyboard function on OnlyM would be grate as then it could be configured to be the same keys as what the PowerPoint viewer makes (in the end they just pressing specific keyboard keys). Hope you implement this soon. It will be used for sure here in Spain 😅

AntonyCorbett commented 6 years ago

@talkingdragon Please check Forms => kingdom hall => kingdom hall video systems => spiritual program guidelines.

VirtSecurity commented 6 years ago

I see the instruction for not having the brother on stage remote control the software we use it to separate the function of video systems brother and sound systems brother. We do not have much room at our sound console for two brothers to sit together there. We have used the remote control on SoundBox to allow the video systems brother to sit in the audience and run the pictures/videos from their seat. This allows some of our older brothers to have a share in helping with the meeting. They are some of the most consistent in caring for this assignment and it only took a little bit of training.

TNRichard commented 5 years ago

Hi, I'm serving in a sign language group. While there is the JW Library SignLanguage, we still have the need for external media like songs, speechs and so on. That's why we actually use Media Player Classic - HE. Actually I checked OnlyM and really missed keyboard controls. When I load a study watchtower, I have to overjump video chapters with questions, or have to jump back to a bible verse to show it again. For that keyboard control is very usefull for us. Maybe this gives a reason to add it in the future.

By the way, usage of the chapters in a video would be great also.

AntonyCorbett commented 5 years ago

@TNRichard thanks. Please would you add a separate issue describing the video chapter support?

vertigo3d commented 5 years ago

Hi Antony, I'd like to chime in. I would really love support for keyboard shortcuts so a brother could advance from one image to another. While we are instructed to not show images from the platform, we have other use cases. For example, in Pioneer Service School, the instructors would like to show images while on the platform and advance from one image to the next. The branch gives them more latitude to do things like this. If OnlyM had that functionality, it would be fantastic.

LvDaniel commented 4 years ago

I believe keyboard controls are helpful especially when more images need to be displayed during a talk. Even if this doesn't happen very often (once a month or so, at least for our congregation) this would be a nice feature.

GregWoods commented 4 years ago

I must admit I was surprised that neither up/down key combination or left/right could be used to move between pictures. Most media programs allow it, including Windows 10 Photos app, so I'm not sure it is strictly a power users feature.

yjenb commented 4 years ago

@GregWoods Oh, I think, it is easy to say so... but it's not so easy to make a concept for this. Why? For example the Windows 10 Photos App can show... Images. Just images. So it is quite clear, what a keyboard command should do. But... OnlyM is a mix... You could say it is a Photo-viewer (Windows 10 Photos, Irfan View...), a slideshow presenter (Powerpoint), a Videoplayer (Windows Media Player, VLC) and a Browser (Chrome) at once. So, it is not that easy... I do have some ideas, but I'm still in making a concept, how OnlyM could behave if you want to use a keyboard command. But if you are thinking about it, you will find some problems you should think twice. Just what I think about this topic.

JPHFanedits commented 4 years ago

I would like to throw my 2 cents in as well. Having a left right keyboard shortcut for at least images would be helpful. After using OnlyM on a few public talks out and the first thing the sound brother does when I am setting OnlyM up is try to use the arrow keys to advance the image

wjrivera commented 3 years ago

Implemented using Play/Pause, Stop and Skip Track media buttons. However the problem is when it goes out of focus, keybinds won't work.
If I can make it to work like Spotify does, where out-of-focus media buttons work on the client, it could be a viable option.
Added this on MainViewModel.cs, not super optimized, but works.

public RelayCommand PlayPauseCommand { get; set; } = null!;
public RelayCommand StopPlayCommand { get; set; } = null!;
public RelayCommand SkipBackwardCommand { get; set; } = null!;
public RelayCommand SkipForwardCommand { get; set; } = null!;
//...
PlayPauseCommand = new RelayCommand(PlayPauseAction);
StopPlayCommand = new RelayCommand(StopPlayAction);
SkipForwardCommand = new RelayCommand(SkipForwardAction);
SkipBackwardCommand = new RelayCommand(SkipBackwardAction);
//...
private void SkipForwardAction()
{
    if (CurrentPage == null) return;
    if (!(CurrentPage!.DataContext is OperatorViewModel page)) return;
    var item = page.MediaItems.FirstOrDefault(x => x.IsMediaActive);
    if (item == null) return;
    var nextOne = page.MediaItems
        .OrderBy(g => g.Title)
        .SkipWhile(x => x.Id != item.Id)
        .Skip(1)
        .FirstOrDefault();
    if (nextOne == null) return;
    if (item.IsVideo) page.MediaControlCommand1.Execute(item.Id);
    page.MediaControlCommand1.Execute(nextOne.Id);
}

private void SkipBackwardAction()
{
    if (CurrentPage == null) return;
    if (!(CurrentPage!.DataContext is OperatorViewModel page)) return;
    var item = page.MediaItems.FirstOrDefault(x => x.IsMediaActive);
    if (item == null) return;
    var index = page.MediaItems.IndexOf(item);
    if (index <= 0) return;
    if (item.IsVideo) page.MediaControlCommand1.Execute(item.Id);
    page.MediaControlCommand1.Execute(page.MediaItems[index - 1].Id);
}

private void PlayPauseAction()
{
    if (CurrentPage == null) return;
    if (!(CurrentPage!.DataContext is OperatorViewModel page)) return;
    if (!page.MediaItems.Any(x => x.IsVideo)) return;
    var existing = page.MediaItems.FirstOrDefault(x => x.IsMediaActive && x.IsVideo);
    if (existing != null) page.MediaControlPauseCommand.Execute(existing.Id);
}

private void StopPlayAction()
{
    if (CurrentPage == null) return;
    if (!(CurrentPage!.DataContext is OperatorViewModel page)) return;
    var item = page.MediaItems.FirstOrDefault(x => x.IsMediaActive);
    if(item != null) page.MediaControlCommand1.Execute(item.Id);
}

And this on MainWindow.xaml

<Window.InputBindings>
    <KeyBinding Gesture="MediaPlayPause" Command="{Binding PlayPauseCommand}" />
    <KeyBinding Gesture="MediaStop" Command="{Binding StopPlayCommand}" />
    <KeyBinding Gesture="MediaNextTrack" Command="{Binding SkipForwardCommand}" />
    <KeyBinding Gesture="MediaPreviousTrack" Command="{Binding SkipBackwardCommand}" />
</Window.InputBindings>