JuliaIO / VideoIO.jl

Reading and writing of video files in Julia via ffmpeg
https://juliaio.github.io/VideoIO.jl/stable
Other
128 stars 53 forks source link

`play` instead of `playvideo` #15

Open ssfrr opened 10 years ago

ssfrr commented 10 years ago

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)
kmsquire commented 10 years ago

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.

ssfrr commented 10 years ago

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
kmsquire commented 10 years ago

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

On Wednesday, August 13, 2014, Spencer Russell notifications@github.com 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.