Audio streaming. Restore playback position after lose internet connection

Tim Müller tim at centricular.com
Wed May 28 09:04:08 PDT 2014


On Wed, 2014-05-28 at 07:18 -0700, ilya.shknaj wrote:
> I try save position and set it after connection restore, but audio begin from
> start

How do you do that? You would have to set the URI, set the pipelinen to
PAUSED state, wait for it to reach PAUSED state (ASYNC_DONE message),
then do a seek to your new position, then set the pipeline to PLAYING
state.
 
 Cheers
  -Tim

> void gst_native_set_uri (JNIEnv* env, jobject thiz, jstring uri) {
>   GST_DEBUG ("Call gst_native_set_uri");
>   CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);
>   if (!data || !data->pipeline) return;
>   const jbyte *char_uri = (*env)->GetStringUTFChars (env, uri, NULL);
>   GST_DEBUG ("Setting URI to %s", char_uri);
>   if (data->target_state >= GST_STATE_READY)
>     gst_element_set_state (data->pipeline, GST_STATE_READY);
>   g_object_set(data->pipeline, "uri", char_uri, NULL);
>   (*env)->ReleaseStringUTFChars (env, uri, char_uri);
>   data->duration = GST_CLOCK_TIME_NONE;
>   data->is_live = (gst_element_set_state (data->pipeline,
> data->target_state) == GST_STATE_CHANGE_NO_PREROLL);
> }
> 

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com



More information about the gstreamer-devel mailing list