obsproject / obs-websocket

Remote-control of OBS Studio through WebSocket
GNU General Public License v2.0
3.79k stars 701 forks source link

Feature Request: Seek or Scrub Media Source #1219

Open respectTheCode opened 2 months ago

respectTheCode commented 2 months ago

Feature Request Type

RPC Request

Feature Request Type (Other)

No response

Requested Feature

It would be great to have away to move the playhead of a media source to an absolute or relative time

Requested Feature Usage Scenario

While a video is playing jump back 15 seconds to repeat a section.

Jumping to the last 30 seconds of a video to see how it ends.

Joefis-x20s commented 1 month ago

You can use GetMediaInputStatus to get the current playback time in milliseconds along with the playback status and the total length of the video.

Using this info just do a calculation on that data and then use SetMediaInputCursor to set the media source to that time. (Be aware of the keyframe interval of your video. As you'd ideally want to seek to a keyframe for eg 2 sec you'd want to seek to 2000,4000,6000....)

TriggerMediaInputAction can also be used to Play/Pause/Restart/Stop the media source. (If you plan on seeking frequently it's best to pause the source before doing so.)