VideoIO.jl icon indicating copy to clipboard operation
VideoIO.jl copied to clipboard

`play` instead of `playvideo`

Open ssfrr opened this issue 11 years ago • 3 comments

In the spirit of generic function names for generic functionality and leveraging dispatch, might I suggest play instead of playvideo for playing a video object?

Currently that's what I use in AudioIO, so if you play an audio object it gets played over the default audio stream. That would keep the general interface the same:

using AudioIO
song = AudioIO.open("my_favorite_song.wav")
play(song)

and

using VideoIO
vid = VideoIO.open("my_favorite_cat_video.mov")
play(vid)

Also note that in AudioIO play returns an AudioPlayer object so you can do playback control:

x = play(song)
sleep(1)
stop(x)

ssfrr avatar Aug 13 '14 14:08 ssfrr

Excellent idea! Right now, we have no audio, no control, and the command just blocks, so we have a little work to do.

I'll be traveling today, so not sure if I'll get to this doon. PRs welcome.

kmsquire avatar Aug 13 '14 15:08 kmsquire

Gotcha. Do you have a preference between blocking/asynchronous play? One thing that I've found handy is to add a wait implementation so that you can easily simulate blocking behavior from the nonblocking API:

x = play(vid)
wait(x) # blocks until the video is complete

ssfrr avatar Aug 13 '14 15:08 ssfrr

No preference. Asynchronous with wait does seem like a nice interface.

On Wednesday, August 13, 2014, Spencer Russell [email protected] wrote:

Gotcha. Do you have a preference between blocking/asynchronous play? One thing that I've found handy is to add a wait implementation so that you can easily simulate blocking behavior from the nonblocking API:

x = play(vid)wait(x) # blocks until the video is complete

— Reply to this email directly or view it on GitHub https://github.com/kmsquire/VideoIO.jl/issues/15#issuecomment-52068861.

kmsquire avatar Aug 13 '14 19:08 kmsquire