Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to handle mediastore addition and deletion during playback?: (8 Items)
   
How to handle mediastore addition and deletion during playback?  
Hello,

I have MME and MCD setup to detect mediastores on USB sticks, how do I handle mediastore addition and deletion due to 
the insertion and removal of the USB sticks during a library based track session playback?

For example, when I have one USB inserted, and I am playing audio files from this USB with track session created using 
the following statement...

select fid from library where msid in (select msid from mediastores where (mountpath="/fs/usb0" or mountpath="/fs/usb1")
 and available=1)

The track session playback will contain only files from USB_1, which is mounted as /fs/usb0. Now, if I inserted a second
 USB stick, it will be mounted as /fs/usb1, will MME add the files from the second USB stick and let the playback 
continue to play files in USB_2 when all files from USB_1 have been played back?

Thanks.
Re: How to handle mediastore addition and deletion during playback?  
MME will not automatically refresh the tracksession to include the new
files.  You will have to call mme_trksessionview_update() to have it
re-run the query.  After this the tracksession should contain tracks from
both mediastores.

If a user disconnects USB_1 (/fs/usb0) while playback is still occurring
on that mediastore you will likely receive playback errors.  MME will try
to play additional tracks and will, most likely, hit the consecutive play
error count limit and stop playback completely.  You should have to update
the tracksession query and re-issue the play command.

How you handle ejections and insertions of mediastores will depend on how
you want your product to behave.  Some products will limit the scope of
tracksessions to a single mediastore (only tracks from USB_1 or USB_2 but
not both); other products will play files across a number of different
connected mediastores.

-- 
Ryan J. Allen
QNX Software Systems

Re: How to handle mediastore addition and deletion during playback?  
Will calling mme_trksessionview_update() affects what's being played back at the time the call was made in any way 
(stops the file currently being playback, etc)? 

In the MME API documentation for mme_trksessionview_update(), it says...

"For both library-based and file-based track sessions, a call to mme_trksessionview_update() refreshes the pseudo-random
 order of the tracks in the track session."

Does it means the files (same file from USB_1 for example) will get a different fid, when USB_2 was inserted and 
mme_trksessionview_update() was called?
Re: How to handle mediastore addition and deletion during playback?  
Yes, trksessionview_update will update the play order.  It should not
affect the currently playing fid.  You should ensure that your playing fid
remains in the tracksession.

The fids themselves will not change by using this call.  The position of
the fid in the tracksession may change, and the random position of the fid
in the tracksession will definitely change.

-- 
Ryan J. Allen
QNX Software Systems



Re: How to handle mediastore addition and deletion during playback?  
Thank you Ryan,

Off to write the code now.
Re: How to handle mediastore addition and deletion during playback?  
Ryan,

If I had only one USB stick inserted and created a track session using the following statement...

select fid from library where msid in (select msid from mediastores where (mountpath="/fs/usb0" or mountpath="/fs/usb1" 
or mountpath="/fs/usb2" or mountpath="/fs/usb3") and available=1)

I used to create a new track session when I detected any of the other USB sticks was inserted, my understanding now is 
that I can use the mme_trksessionview_update() to refresh the files in the track session and have new files included 
when any of the other USB was inserted or removed.

So there is really no need to call mme_settrksession() anymore if all I needed are the files from any of those possible 
mediastores, is this correct?

Thanks.
Re: How to handle mediastore addition and deletion during playback?  
Yes, your plan would work as long as your goal was to treat media from all
USB sticks as if it was available in one tracksession.

Note: you'll want to update your tracksession after files pass (1st pass)
of the newly inserted mediastore is complete.

-- 
Ryan J. Allen
QNX Software Systems

Re: How to handle mediastore addition and deletion during playback?  
Thank you. Back to coding now... :)