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

Bug: After OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP, OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY doesn't work as expected. #1046

Open
tinodo opened this issue Oct 27, 2022 · 1 comment

Comments

@tinodo
Copy link

tinodo commented Oct 27, 2022

Operating System Info

Windows 11

Other OS

No response

OBS Studio Version

Other

OBS Studio Version (Other)

28.0.3

obs-websocket Version

5.0.1

OBS Studio Log URL

https://obsproject.com/logs/I5BL7WZ0WjbXHYn_

OBS Studio Crash Log URL

No response

Expected Behavior

After calling TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP"), I expect to be able to start playing the Media Input again using TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_START").

Current Behavior

After calling TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP"), I cannot start to play the Media Input anymore using TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_START"). This is unexcepted.

Steps to Reproduce

  1. Call TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP") to stop playing a media input.
  2. Then call TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_START") to start it again.

Anything else we should know?

When using WebSockets to stop playing a media input using TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP"), I cannot start to play the Media Input anymore using TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_START"). Looking at the source code (RequestHandler_MediaInputs.cpp), I can see that the implementation is not what I would expect;

case OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY:
	// Shoutout to whoever implemented this API call like this
	obs_source_media_play_pause(input, false);
	break;
case OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP:
	obs_source_media_stop(input);
	break;
case OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART:
	// I'm only implementing this because I'm nice. I think its a really dumb action.
	obs_source_media_restart(input);
	break;

Thanks to the developer that put in that "dumb" action called "RESTART", because actually calling "RESTART" is the only option to start playing again. If this is proper, then why have a START and a RESTART? What would be the difference?

The implementation is not what I expect, and I hope you can agree.

ALSO: After calling TriggerMediaInputAction(InputName, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP"), I can't press PLAY in the UI anymore either... I have STOP it there and RESTART it to get it playing again...

@ChristopheCVB
Copy link
Contributor

ChristopheCVB commented Nov 18, 2022

You may want to take a look at the freshly documented enum for OBSMediaInputAction (don't mind the deprecated warnings, it's not), because that OBS_WEBSOCKET_MEDIA_INPUT_ACTION_START doesn't exist. You have to use OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART after stopping a Media Input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants