When the library returns >1 media streams, you can access them using the quvi_media_stream_next and quvi_media_get as described in Parsing media properties. Alternatively, the convenience functions quvi_media_stream_choose_best and quvi_media_stream_select could also be used.
In the above example, we tell the library to choose the stream that was determined (by the media script) to be of the best quality.
In the example below, we are only interested in a specific stream with the specified stream ID ("foo"). If it is not found (matched), the library falls back to the default stream.
Since quvi_media_stream_select takes regular expression patterns, the following is also possible:
The value may also be a comma-separated list of patterns, e.g.:
Make a note of the use of the 'croak' keyword. This would cause the library to return an error if it was reached, e.g. none of the first three patterns matched any of the available Media stream ID. This is also the reason why an application should always quvi_ok after calling quvi_media_stream_select and handle the error, if any.
Refer to the API documentation of quvi_media_stream_select for more details.