Additional resources

Play a cut-scene video

Say you're developing a game, and you want to play to a cut-scene video. You can use the multimedia render service to make playing a cut-scene video easier. The multimedia renderer, mm-renderer, is a connection-based service that controls the playback of media from an input and directed to one or more outputs.

Below is an example of how the code looks. To start the mm-renderer service, we first establish a connection by calling mmr_connect(). When we establish a connection, we create contexts, attach inputs and outputs, and make requests to play media.

    mmr_connection_t* mmr_connection;       
    mmr_connection = mmr_connect(NULL);           

    mmr_context_t*    mmr_context;       
    mmr_context = mmr_context_create(mmr_connection, video_context_name, 0, S_IRWXU|S_IRWXG|S_IRWXO);           
    
    int video_device_output_id;      
    video_device_output_id = mmr_output_attach(mmr_context, video_device_url, "video");           
    int audio_device_output_id;      
    audio_device_output_id = mmr_output_attach(mmr_context, audio_device_url, "audio");           

    char cwd[PATH_MAX];       
    getcwd(cwd,PATH_MAX);           

    char media_file[PATH_MAX];       
    snprintf(media_file, PATH_MAX, "file://%s/app/native/pb_sample.mp4", cwd);
          
    mmr_input_attach(mmr_context, media_file, "track");      
    mmr_play(mmr_context);   

For more information on using the mm-renderer service, take a look at the Multimedia Renderer Developer's Guide.

If you're looking for a complete tutorial on playing a video using the mm-renderer service, seeTutorial: Play a video .

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus