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

Requests/Events: Media Source/VLC #497

Merged
merged 10 commits into from
Jul 3, 2020
Merged

Conversation

tt2468
Copy link
Member

@tt2468 tt2468 commented May 11, 2020

Adds the following requests into a new category called MediaControl:

  • PlayPauseMedia
  • RestartMedia
  • StopMedia
  • NextMedia
  • PreviousMedia
  • GetMediaDuration
  • GetMediaTime
  • SetMediaTime
  • ScrubMedia
  • GetMediaState
  • GetMediaSourcesList

Adds the following events into a new category called Media

  • MediaPlaying
  • MediaPaused
  • MediaRestarted
  • MediaStopped
  • MediaNext
  • MediaPrevious
  • MediaStarted
  • MediaEnded

Notes:

  • I believe this requires at least OBS 25.0.8
  • As with any large code change/addition, it would be nice to get some testers to bug test this. You should be able to download the plugin binaries through Azure pipelines.

Resolves #494

Works better with the other upcoming media control request names
@tt2468 tt2468 changed the title Add media control requests Requests: Media Control requests May 14, 2020
Adds the following events:

- `MediaPlaying`
- `MediaPaused`
- `MediaRestarted`
- `MediaStopped`
- `MediaNext`
- `MediaPrevious`
- `MediaStarted`
- `MediaEnded`
@tt2468 tt2468 changed the title Requests: Media Control requests Requests/Events: Media Source/VLC May 16, 2020
@tconley
Copy link

tconley commented May 19, 2020

Would love to test this. i'm interested in creating a dock that gives playback controls and countown timer for media. idealy this would be for the program view as well as the preview view in studio mode.

@tt2468
Copy link
Member Author

tt2468 commented May 20, 2020

@tconley If you download the windows artifact from this page, it has an installer for obs-websocket with these features: https://dev.azure.com/Palakis/obs-websocket/_build/results?buildId=1243&view=artifacts&type=publishedArtifacts

@tconley
Copy link

tconley commented May 20, 2020

Cool. I'm able to issue the requests like below.
{ "request-type":"PlayPauseMedia", "sourceName":"movie1", "playPause":false, "message-id":"12324" }

Should 'MediaPlaying' be return anytime that media is playing or only when i've triggered it via PlayPauseMedia? For example if I click 'transition' in OBS Studio I get info back from websocket about that fact that SwitchScenes has happened, but I'm not getting back MediaPlaying

@tconley
Copy link

tconley commented May 20, 2020

Cool. I'm able to issue the requests like below.
{ "request-type":"PlayPauseMedia", "sourceName":"movie1", "playPause":false, "message-id":"12324" }

Should 'MediaPlaying' be return anytime that media is playing or only when i've triggered it via PlayPauseMedia? For example if I click 'transition' in OBS Studio I get info back from websocket about that fact that SwitchScenes has happened, but I'm not getting back MediaPlaying

Figured that out, I am getting MediaStarted/MediaEnded events

@tt2468
Copy link
Member Author

tt2468 commented May 20, 2020

@tconley So the requests simple forward to internal requests in OBS, and the events simply forward signals coming from OBS.

In my testing, the media source had very different event behavior than the VLC source did. I honestly could not tell you whether something should or should not happen.

@tconley
Copy link

tconley commented May 20, 2020

I was able to use these to come up with little webpage that finds all the media sources of typeID ffmpeg_source , added play/pause buttons and also a button to change the audio monitoring type for that source. super helpful to have this committed to obs-websocket!

Adds `GetMediaSourcesList` which returns a list of all media sources,
along with their individual media playback states. In the process I
refactored a switch which coverts the enum to a QString into its own
helper function.
@tt2468
Copy link
Member Author

tt2468 commented May 20, 2020

@tconley New request GetMediaSourcesList hot off the press.

@tconley
Copy link

tconley commented May 20, 2020

@tt2468 PlayRickRollInCurrentScene might be a good addition too :-)

@tt2468 tt2468 marked this pull request as ready for review May 20, 2020 23:08
@Palakis Palakis added this to the 4.9 milestone May 28, 2020
@PurpleMyst
Copy link

Hi! I need exactly this PR. Is it production ready? Can I just compile it myself and use it?

@tt2468
Copy link
Member Author

tt2468 commented Jun 8, 2020

@PurpleMyst I've just merged the main branch into the pr branch to update it to the latest features. Once the checks finish, you will be able to download the precompiled binaries for your appropriate OS here: https://dev.azure.com/Palakis/obs-websocket/_build/results?buildId=1282&view=artifacts&type=publishedArtifacts

@PurpleMyst
Copy link

Ah thank you. I'm not familiar with the windows compilation story and was having a hard time figuring it out.

src/WSEvents.cpp Show resolved Hide resolved
src/WSRequestHandler_MediaControl.cpp Outdated Show resolved Hide resolved
src/WSRequestHandler_MediaControl.cpp Outdated Show resolved Hide resolved
Move duplicated functionality to a helper function and added some docs
clarifying the behavior of the events, and fixed a few typos in
the request handlers.
@Palakis Palakis self-requested a review July 3, 2020 08:34
src/WSRequestHandler_MediaControl.cpp Outdated Show resolved Hide resolved
src/WSRequestHandler_MediaControl.cpp Outdated Show resolved Hide resolved
@Palakis Palakis merged commit eea56b4 into 4.x-current Jul 3, 2020
@tt2468 tt2468 deleted the category-mediacontrol branch December 20, 2020 07:00
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.

OBS Media functions
4 participants