Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

feat/gui video common play #2683

Closed
wants to merge 14 commits into from
Closed

feat/gui video common play #2683

wants to merge 14 commits into from

Conversation

JarbasAl
Copy link
Contributor

Starts integrating gui video playback into the common play framework

  • adds self.gui.play_video
  • makes gui video playback respond to playback control skill
    • pause
    • resume
    • stop

see usage here https://github.com/JarbasSkills/skill-dagon/blob/feat/gui_common_play/__init__.py#L124

@devops-mycroft devops-mycroft added the CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) label Aug 27, 2020
@JarbasAl JarbasAl requested review from forslund and AIIX August 27, 2020 08:57
@JarbasAl JarbasAl changed the title gui play video common play feat/gui video common play Aug 27, 2020
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

1 similar comment
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

Copy link
Collaborator

@forslund forslund left a comment

Choose a reason for hiding this comment

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

I think this looks good I think. The thing I notice is that unlike the show_* this doesn't clear the current namespace when starting to show video.

We might want to think about how the show_* methods clears the namespace...It may cause skill creators some headache if they mix a show_* with normal pages. But that's outside of the scope of this PR.

I made a couple of minor comments, the missing docstring should be added before merge. And I'll leave the qml to be reviewed by @AIIX (since I'm terrible with it)

mycroft/enclosure/gui.py Outdated Show resolved Hide resolved
mycroft/enclosure/gui.py Show resolved Hide resolved
@JarbasAl
Copy link
Contributor Author

seems like we are moving to a centralize playback module per https://docs.google.com/document/d/1ebS60QLna4_AOQxQYpoaZrpkBzPXjL-7VFPJ7-xVvIQ/edit maybe this no longer makes sense if its going to be replaced soon?

@forslund
Copy link
Collaborator

forslund commented Sep 14, 2020

My thinking is that this could still be of use since the playback module described there would need to talk to the gui in some fashion and this is the best api for that.

Edit: This is my humble opinion we should probably hear @krisgesling's thoughts on the matter

mycroft/enclosure/gui.py Outdated Show resolved Hide resolved
@krisgesling
Copy link
Contributor

IMHO, I think it will be safer to get the architecture nailed down first then we can be sure about the changes.

@JarbasAl
Copy link
Contributor Author

JarbasAl commented Sep 20, 2020

IMHO, I think it will be safer to get the architecture nailed down first then we can be sure about the changes.

i still think this should be considered, it's a simple and straightforward change, i don't see the SPEC going in any direction where this change will be invalid

furthermore the SPEC is in very early stages and any implementation is not even being considered much less assigned, we are talking about delaying this change for months without any alternative available

if this is the official stance i will probably be closing this PR and adding this to my jarbas_utils package and start importing it in my skills, otherwise i will be duplicating a lot of code and have to maintain it in sync across many repos

when the SPEC gets off the idea stage into something concrete i will gladly update this

EDIT: clarification, by update i mean that i will re-open the PR (if rejected now) or make a new one with any changes needed according to SPEC, essentially i am volunteering to maintain this functionality

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

Copy link
Contributor

@krisgesling krisgesling left a comment

Choose a reason for hiding this comment

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

Yeah, I think I was bit rash last week. This will be needed whether we take the new direction or not. So I'm in favour of it being merged when ready

mycroft/enclosure/gui.py Show resolved Hide resolved
mycroft/res/ui/SeekControl.qml Outdated Show resolved Hide resolved
mycroft/skills/mycroft_skill/mycroft_skill.py Outdated Show resolved Hide resolved
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

1 similar comment
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

mycroft/enclosure/gui.py Show resolved Hide resolved
mycroft/skills/mycroft_skill/mycroft_skill.py Outdated Show resolved Hide resolved
function formatTime(timeInMs) {
if (!timeInMs || timeInMs <= 0) return "0:00"
var seconds = timeInMs / 1000;
var minutes = Math.floor(seconds / 60)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add in an hours that is only shown if time > 1hr.

Would also need to pad the minutes if (hours > 0 && minutes < 10)

Copy link
Collaborator

Choose a reason for hiding this comment

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

still need to implement this, If i understand correctly an hour would be represented like "1:05:04" "H:M:S" format, and on duration change once it changes below an hour on displayed video would still be represented like "0:50:04" "H:M:S" format or "50.04" "M:S" format ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, good question, I hadn't thought of that but I like the idea of keeping the "H:M:S" format if the total duration is > 1hr but the time remaining drops below 1:00:00.
Where as if the total duration was < 1hr it would only ever show the "M:S" format.

I think it's less cognitive load for the user, it indicates that we're under an hour to go, and less chance of strange things happening when rendering the time remaining to screen.

@dschweppe do you have an opinion?

@MetaGamer
Copy link

MetaGamer commented Sep 21, 2020 via email

@AIIX
Copy link
Collaborator

AIIX commented Sep 21, 2020

Created a media player Icon Set that can be freely used with a CC0 1.0. license, free for commercial use and no attributions required. https://github.com/AIIX/SimpleMedia-Icons/
media-icons

@devops-mycroft
Copy link

Voight Kampff Integration Test Failed (Results)

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@krisgesling
Copy link
Contributor

Hey @AIIX I've just done some minor clean up and added a series of tests, if you could double check it, I think we're good to go.

@krisgesling krisgesling added Status: To be reviewed Concept accepted and PR has sufficient information for full review and removed Status: Change requested labels Mar 30, 2021
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

1 similar comment
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@krisgesling
Copy link
Contributor

@ken-mycroft - from our brief discussion today - here's the spec I mentioned:
https://docs.google.com/document/d/1ebS60QLna4_AOQxQYpoaZrpkBzPXjL-7VFPJ7-xVvIQ/edit?usp=sharing

As suggested by the spec, I think we should be moving toward an integrated "media" playback service and that Skills should interact with that so the system can more easily know and express it's own state. Either way the GUI needs a way to play that video, so I think this is moving in the right direction however in this PR's current state the interface for playing a video would be directly in the GUI module.

@ken-mycroft
Copy link
Contributor

Please forgive me for my ignorance, but why could I not simply add a fourth and fifth type (.mov and .mp4) to the existing simple audio service and let it figure out which player to use like it does now with .mp3 vs .wav (and I believe ogg). In this way nothing above it would change and it would conform to existing commands like play, stop, etc. We would simply need to add a new config value (mp4_cmd=qvlc) and add the qvlc plugin (for QT environments) to the requirements.txt file. Skills would continue to play media the same way they do now, or am I missing something very basic here?

@AIIX
Copy link
Collaborator

AIIX commented Jun 3, 2021

Please forgive me for my ignorance, but why could I not simply add a fourth and fifth type (.mov and .mp4) to the existing simple audio service and let it figure out which player to use like it does now with .mp3 vs .wav (and I believe ogg). In this way nothing above it would change and it would conform to existing commands like play, stop, etc. We would simply need to add a new config value (mp4_cmd=qvlc) and add the qvlc plugin (for QT environments) to the requirements.txt file. Skills would continue to play media the same way they do now, or am I missing something very basic here?

Mycroft-Core handles audio playback externally via VLC or whatever different from the Qt implementation, The same is not applicable to videos and not even possible to do as any video playback directly requires a video surface creation and this is directly handled with Qt's official multimedia backend and video qml type https://doc.qt.io/qt-5/qml-qtmultimedia-video.html which assumes all control and responsibility for video playback of the streaming or local video using Linux's multimedia gstreamer provider.

So the major difference between audio and video via CPS is:

  • Audio: Playback Control flows from Mycroft Core to GUI with all control assumed by common play framework
  • Video: Playback Control flows from GUI to Mycroft Core & CPS via events

Qt does not officially support qvlc and qml vlc extensions are not mature and don't seem even maintained anymore. Additionally there is no support for opening external application windows and controlling external Linux application window behavior.

@AIIX
Copy link
Collaborator

AIIX commented Jun 3, 2021

Additionally most of the spec sheet being mentioned here has already been implemented by @JarbasAl in another project and can be found here https://github.com/OpenVoiceOS/OVOS-workshop/blob/master/ovos_workshop/frameworks/cps/__init__.py

@ken-mycroft
Copy link
Contributor

Quick question, is this https://github.com/OpenVoiceOS/OVOS-workshop/blob/master/ovos_workshop/frameworks/cps/__init__.py included in this PR? My concern is backward compatibility in non qt environments and this code seems to handle that, albeit in an interesting way.

@AIIX
Copy link
Collaborator

AIIX commented Jun 3, 2021

Quick question, is this https://github.com/OpenVoiceOS/OVOS-workshop/blob/master/ovos_workshop/frameworks/cps/__init__.py included in this PR? My concern is backward compatibility in non qt environments and this code seems to handle that, albeit in an interesting way.

No I believe that implementation by @JarbasAl https://github.com/OpenVoiceOS/OVOS-workshop/blob/master/ovos_workshop/frameworks/cps/__init__.py is a total refactor of the CPS framework based on the spec sheet with few more extensions,

This PR is only meant to handle show_video in the Qt context currently based on the current CPS implementation in mycroft-core, any kinds of backward compatibility etc should probably be handled separately under some other PR. As @JarbasAl was the original author of this PR he might know better.

There were also some additional PR's by Jarbas for CPS spec implementation but were closed. I do not know if the above refactor done under OVOS relates but some of them are:

@JarbasAl
Copy link
Contributor Author

JarbasAl commented Jun 3, 2021

Just want to note that I tried to do this upstream across several prs, due to lack of interest and feedback I moved dev to ovos and am not following that spec, the ovos repo is not a great reference for this specific PR since it does so much more things

Not sure on status of this pr, but it should be quite basic and one of the first pieces, no conflicts with any of the other work I did

@JarbasAl
Copy link
Contributor Author

JarbasAl commented Jun 4, 2021

@ken-mycroft Here is what i could find, these are the PRs related to the better common play framework that i made before deciding to make this under https://github.com/OpenVoiceOS/OVOS-workshop . There are some more PRs in some of the official skills also (news skill ?)

These PRs partially informed the SPEC linked above

@JarbasAl
Copy link
Contributor Author

closing this PR in favor of the new audio backend plugin

this PR is very old and outdated

@JarbasAl JarbasAl closed this Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) Status: Abandoned by author Author has not responded and PR will be (or has been) closed. Status: To be reviewed Concept accepted and PR has sufficient information for full review Type: Enhancement - roadmapped Implementation of a feature that is a priority on the roadmap.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants