Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 13
Registered: ‎04-11-2012
My Device: Blackberry Playbook, Blackberry 10 Dev Alpha
My Carrier: None
Accepted Solution

mmr video progress and/or finished

Hey guys,


I'm trying to figure out how to find out when a video is finished playing? I followed the tutorial for playing a video in an opengles application, but it doesn't do anything but set speed and play. Going through the multi-media renderer header I couldn't seem to see anything to help me with this either.


This is neccisary to have my game start after a video spash screen. I would highly prefer not to simply hard code the length of the video and hit a timer to check the progress. This would be hyper silly.


Also, is there a way to set the progress in a video? This is less important, but I would like to have a nicely flushed out C++ wrapper with common functionality (stop, pause, play, skip, etc.).


Thanks in advance!


Posts: 150
Registered: ‎10-19-2010
My Device: Not Specified
My Carrier: Rogers

Re: mmr video progress and/or finished

[ Edited ]

Hi Jared!


mm-renderer publishes information that lets you access this information.  You can use BPS API's to be notified of them, or the PpsAccessor/PpsObject API (C++ or Cascades).  I recommend the latter approach... Sulman and I did a presentation on this very topic at the BB10Jam in early May, the code is not up yet but will be shortly.  In the meantime, here's a very condensed version of what to do - not all of it is documented so I apologize if not all of it makes 100% sense yet (I am working hard to get it documented asap!):


// Subscribe to PPS notifications in 'delta' mode (i.e. only listen for changes)
    PpsObject ppsObject(QString("/pps/services/multimedia/renderer/context/%1/.all?wait,delta").arg(CONTEXT_NAME)));

// Open the Object for reading
    if (!ppsObject->open(bb::PpsObject::Subscribe)) {
        int errorCode = ppsObject->error();
        qDebug() << "Error: " << errorCode;

// Create an accessor to be notified asynchronously (via 'dataRecieved') of new data
    PpsAccessor ppsAccessor(ppsObject.data()));
    QObject::connect(ppsAccessor.data(), SIGNAL(received(QVariantMap)), this, SLOT(dataReceived(QVariantMap)));


// MMRenderer tells us of new data:
void dataReceived(QVariantMap data) {

    // Print out what MMRenderer sends us, this let's us see what sort of things we can act on...
    qDebug() << "Data:" << data;

    if (data.contains("@metadata")) {
        // New track has been loaded, here's how we can access duration, title, artist, etc.
    if (data.contains("@state")) {
        // MMRenderer is changing state to stopped, or playing, etc.
    if (stateMap.contains("speed")) {
        // MMRenderer's speed has changed, if speed = 0 we are paused, if speed < 0 we are playing in reverse!  speed < 1 is slo-mo, 1 = normal speed, > 1 is fast-forward.
    if (stateMap.contains("error")) {
        if (error == "0") {
            // This means we are at the end of playback... weird I know.
        } else {
            // ...otherwise a legitimate error occurred.  MMRenderer is already stopped automatically
    if (data.contains("@status")) {
        if (statusMap.contains("position")) {
            // This current playback position is sent approx. once per second, this is how you update a seek bar for example.


That's a bit rough but hopefully you get the idea.  Print out the map to see what sorts of information you can parse. 


Again, most of this (well, probably all of this!) is not currently documented, but I am working diligently to get this rectified asap!  Thanks for being patient... in the meantime feel free to ask new questions as they come up, and I will try my best to help with anything multimedia related!  I am pretty busy these days so I can't guarantee a timely response, but others may be able to help as well.




Posts: 25
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Movistar

Re: mmr video progress and/or finished

Hello I'm trying to compile this code but I'm having several errors.

Can you post a running example on how to get notifyied on playback end, please?