11-01-2009 12:05 AM
Having random file access in 5.0 is good. Except all I've seen is an interface that nothing seems to implement (yet?)
Have I missed something? Or are there going to be some classes in 5.0 that will eventually implement this interface?
Solved! Go to Solution.
11-01-2009 01:17 AM
It might just be that the documentation has not been updated. I can't find anything that implements it but it doesn't mean it's not implemented somewhere.
11-01-2009 01:50 PM
The OS does not have to provide implementations of these interfaces. It could be the other way round: the OS or the built-in media player could be the clients of these interfaces.
When you implement your own SourceStream, you can make it provide controls that implement this interface (or any other media control interfaces for that matter). It would be interesting to see whether the built-in media player starts invoking methods on this interface if you provide the player with a media control implementing the interface.
11-01-2009 03:45 PM
If the OS or media player (and media applications aren't the only intended use with random file access!) are clients of the interface, some API class must implement them somewhere, if those applications make use of the public API -- if they do not, then we're back where we've started -- no classes as far as I've seen implement the interface so there's no actual implementation of random file access as far as I've seen or understood.
11-01-2009 04:04 PM
In theory, not a single class in the BlackBerry OS has to implement the interface. In partice, some of them probably do.
The OS's media player playback module does not have to implement the Seekable interface -- it is rather a client of the interface. Some of the built-in implementations of media sources, for example, those that play local files, might provide controls that implement this interface. However, these classes aren't usually covered by the javadocs offered to third-party developers.
Therefore, I don't find it strange that there are no classes in third-party developer javadocs that implement the Seekable interface. I think the reason for this interface being listed in the javadocs is twofold. Firstly, (you being a provider) you can implement your own controls that offer the Seekable capability and the media player might take advantage of these controls since it knows about the Seekable interface. Secondly, (you being the consumer/client) if you instantiate some built-in media sources, they might provide you with a control that implements the Seekable interface, thus enabling your application to perform more actions on the source/stream.
11-01-2009 04:20 PM
Yes, I'm well aware of this.
I think what it boils down to is this: in the release notes and documentation about new API features in 5.0, "Random File Access: Read data from and write data to any specified location within a file" is what is described. I expect that to mean that I should be able to, somehow, be able to do this. You are describing a perfectly valid use-case scenario for this interface, but having one interface with no additional provided classes implementing it does not match what is advertised "on the tin".
(NB: I could subclass an InputStream and very well implement Seekable, but anything that I produce is not going to be nearly as efficient or correct as something that is API-provided).
11-01-2009 04:23 PM - edited 11-01-2009 04:26 PM
P.S. It occurred to me after some thinking, that you might be puzzled about Seekable and other such media control interfaces because you think there should be a ready-made control that you can instantiate and pass into an arbitrary media player attached to an arbitrary media source. I don't believe that's the case, because the design of the media player API seems to assume that the media player obtains controls from the particular media source it's playing and these controls "know" how to control this particular source.
EDIT: sorry, I posted this almost at the same time with you posting your last comment, so I didn't take your comment into account.
11-01-2009 04:26 PM - edited 11-01-2009 04:27 PM
I don't intend to use random file access for media playing purposes.
What I intend to do is to try and implement a mechanism for reading large files without having to slurp them up entirely into memory or have linear access to (which an InputStream only provides).
Hey, if someone knows a way of doing this without random file access, let me know, but I sure can't think of anything so far.
11-01-2009 04:29 PM - edited 11-01-2009 04:30 PM
Please disregard all my comments in this thread. I was under a very wrong impression that this thread was about media control interfaces. I completely missed the fact that Seekable is in a completely different package and has nothing to do (directly) with media playback.
I can't seem to find a way to delete my blatantly wrong comments... Let's hope people don't get too confused when reading these comments...