Duration is always 0

Discuss issues related to PS3 Media Server development (only for programmers)

Duration is always 0

Postby SeeSoubleYou » Thu Nov 17, 2011 8:43 am

Hey Guys,

I started on a plugin to see whether a file was watched before. One problem I run into now is to retrieve how much of a file has been watched. I've implemented a StartStopListener with the public void donePlaying(DLNAMediaInfo media, DLNAResource resource) method. Now, whenever I do media.getDurationInSeconds() is always returns 0. Basically what I had in mind, was to get the total duration, and than to check were playback was at (don't know how to this either).
I am running the latest build of ps3mediaserver from svn.

Hope you can help.
It is actually SeeDoubleYou...
SeeSoubleYou
 
Posts: 21
Joined: Sun Jan 10, 2010 8:57 pm

Re: Duration is always 0

Postby taconaut » Thu Nov 17, 2011 8:51 am

I've got a plugin doing that for pms-mlx if you want to have a look. http://pms-mlx.svn.sourceforge.net/view ... herPlugin/
At the time I've coded it, the StartStopListener would be notified too often, that's why it has a queue where only the oldest and newest notification will be considered. I the notification bug has been resolved by now.
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Duration is always 0

Postby SeeSoubleYou » Thu Nov 17, 2011 9:22 am

Thanks man, seems you actually do the same thing, still it doesn't work for me. Does mlx run with the latest svn version of ps3mediaserver? Also, were does the queue you use get initiated?
It is actually SeeDoubleYou...
SeeSoubleYou
 
Posts: 21
Joined: Sun Jan 10, 2010 8:57 pm

Re: Duration is always 0

Postby taconaut » Thu Nov 17, 2011 9:41 am

Yep, I think our goals are the same. Just to show what happens, when calling storage.updatePlayCount, the last played date for the file is being set to the time the file ended playing and its counter for the number of plays is being incremented (if 80% of the file has been played). This way conditions like e.g. 'show all files haven't been played the last 3 months' or 'show all files having been played at least 5 times' can be set.
I always keep mlx up to date with the latest official release. As it's quite a hassle to merge the code, I won't keep it up to date with the trunk or beta releases.
The queue is being initialized when the PlayCountWatcher is being initialized. Every time a start playing notification is being received, it is being enqueued with the id of the resource and when it started playing. It's then being dequeued (using FILO) when done playing is being called.
For me the play lengths always works fine. You can try changing the mediainfo attribute for the renderer configuration you're using to see if it changes anything.
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Duration is always 0

Postby SeeSoubleYou » Thu Nov 17, 2011 9:58 am

Ok, thanks for the update. I can work on it tonight, so I will update here to show progress (if any ;))
The notification bug has been fixed by the way, so a queue might not be necessary.
It is actually SeeDoubleYou...
SeeSoubleYou
 
Posts: 21
Joined: Sun Jan 10, 2010 8:57 pm

Re: Duration is always 0

Postby taconaut » Thu Nov 17, 2011 10:23 am

If the notification bug has been fixed, you only need a queue if you want to support multiple renderers streaming files at the same time from the same instance of pms. My implementation currently doesn't support that.
Good luck and have fun :)
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Duration is always 0

Postby SeeSoubleYou » Thu Nov 17, 2011 3:26 pm

It seems that it depends on the renderer. When watching files on an android device running bubbleUPNP and then trough MoboPlayer (which I used for quick testing), then getDurationInSeconds() will always return 0. It will however return a value > 0 when watching on a PS3.
It is actually SeeDoubleYou...
SeeSoubleYou
 
Posts: 21
Joined: Sun Jan 10, 2010 8:57 pm

Re: Duration is always 0

Postby SeeSoubleYou » Thu Nov 17, 2011 4:06 pm

@taconaut: I've looked into your solution. You use the time when the file was started to compute how much was viewed. This means that when you start it and then pause it, leave it on pause for a while, then this will count as if you watched it. This could cause an over 100% watched rate. Problem is that this seems the only way to do it since I can't find a way to determine the exact moment in the file it was stopped.
It is actually SeeDoubleYou...
SeeSoubleYou
 
Posts: 21
Joined: Sun Jan 10, 2010 8:57 pm

Re: Duration is always 0

Postby taconaut » Thu Nov 17, 2011 4:15 pm

I'd guess if you check the two renderer configuration files you're using one will have mediainfo = true and the other one false!?
You're right with the pause problem (guess you've seen the TODO comment in my code as well). We would need an additional method in the interface called something like 'public void pausePlaying(DLNAMediaInfo media, DLNAResource resource)'. I don't know if it is even possible for pms to give this info (does the renderer send a message telling to pause? does it stop consuming the stream and this would have to be detected?); wanted to dive into the code at some point to check this out, but haven't done so yet.
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1104
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Duration is always 0

Postby SeeSoubleYou » Thu Nov 17, 2011 4:29 pm

Actually, then it can still go wrong. If for example you have watched a file for 80% and later on you start the file again and skip to 80% of the file and watch it to the end, the calculation will say you have watched it for 20%. In essence this is true, but not suitable for what I want.

See also this new thread I made on the plugin: viewtopic.php?f=11&t=12671
Last edited by SeeSoubleYou on Tue Nov 22, 2011 6:39 pm, edited 1 time in total.
It is actually SeeDoubleYou...
SeeSoubleYou
 
Posts: 21
Joined: Sun Jan 10, 2010 8:57 pm

Next

Return to Developers

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest