Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8271321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:48:33+00:00 2026-06-08T06:48:33+00:00

I’m working on an android UPnP/DLNA app. I have a control point working where

  • 0

I’m working on an android UPnP/DLNA app. I have a control point working where I can stream files from media server to renderer. I can pause/play and stop the file during playback but I cannot seem to figure out how to integrate a seekbar into the control point to show the progress of the playing file and be able to interact with the seekbar. I am using the Cling Java library to create the app. If anyone has any examples that could help me I would really appreciate it.

Thanks

I’ve tried to implement the SubscriptionCallback example and subscribe to LastChange

SubscriptionCallback callback = new SubscriptionCallback(service, 600) { // Timeout in seconds

                 public void established(GENASubscription sub) {
                     System.out.println("Established: " + sub.getSubscriptionId());


                 }
                 @Override
                 public void failed(GENASubscription sub, UpnpResponse response, Exception ex) {
                     System.err.println(
                         createDefaultFailureMessage(response, ex)
                     );
                 }
                 @Override
                 public void ended(GENASubscription sub, CancelReason reason, UpnpResponse response) {
                     // Reason should be null, or it didn't end regularly
                 }

                 public void eventReceived(GENASubscription sub) {
                     System.out.println("Event: " + sub.getCurrentSequence().getValue());


                               try {
                                   lastChange = new LastChange(
                                           new AVTransportLastChangeParser(),
                                           sub.getCurrentValues().get("LastChange").toString()
                                   );


                               } catch (Exception ex) {
                                   log.warning("Error parsing LastChange event content: " + ex);
                                   return;
                               }

                     Map<String, StateVariableValue> values = sub.getCurrentValues();
                     StateVariableValue status = values.get("Status");
                     System.out.println("Status is: " + status.toString());
                 }

                 public void eventsMissed(GENASubscription sub, int numberOfMissedEvents) {
                     System.out.println("Missed events: " + numberOfMissedEvents);
                 }
                @Override
                protected void failed(GENASubscription arg0,
                        UpnpResponse arg1, Exception arg2, String arg3) {

                }
            };

            upnpService.getControlPoint().execute(callback);

Then I try to get the duration of the current playing track:

System.out.println("Duration: "+lastChange.getEventedValue(0, AVTransportVariable.CurrentTrackDuration.class).getValue());

but this returns a NullPointerException.

Any ideas???????

************UPDATE***********

I have been trying to implement Seek() but have not had success.

I have my seekbar and listener but it it keeps failing when I drag the seekbar to a new position.

seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() 
{
        @Override
        public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) 
        {
            Log.i("SEEKTIME", "time:" + arg1);
            upnpService.getControlPoint().execute(new Seek(service, SeekMode.REL_TIME, arg0.toString())
            {
                @Override
                public void success(ActionInvocation invocation)
                {
                    //super.success(invocation);
                    Log.i("SEEKSUCCESS", "success seek");
                }
                @Override
                public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2)
                {
                    Log.i("SEEKFAIL", "fail seek");
                }
            });
        }

Any suggestions why this would be failing

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:48:34+00:00Added an answer on June 8, 2026 at 6:48 am

    You must poll the renderer for this kind of information (see AVTransport spec chapter 2.3.1). The spec encourages polling every second, but you can easily jam up a real hardware renderer (for which DLNA is still rather a fashionable pain in the a** than a vital part of the design). Our established practice is to send GetPositionInfo() request every 2-3 seconds and treat the returned RelativeTimePosition value only as an adjustment to locally running timer. For the seekbar sizing you also need the total length of current media. Ideally the renderer will tell you automatically when you subscribe to AVTransport.LastChange. I don’t know Cling specifically but a quick look shows promising example in controlpoint.SubscriptionCallback. Unfortunately with real devices, LastChange often doesn’t tell you anything much. Either the values are not there at all or have a constant inert value. So you will need to poll the GetMediaInfo() again and use MediaDuration value.

    As for interaction, Seek() is your friend, ideally with parameters of Unit = REL_TIME and Target = your desired time offset. Be aware that a real world renderer may not be supporting this unit (mode) of seeking. Perhaps it supports only TRACK_NR in which case the seekbar is essentialy read-only for you. Again Cling should be able to tell you allowed values of A_ARG_TYPE_SeekMode for the particular renderer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I have thousands of HTML files to process using Groovy/Java and I need to
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.