locked
[FMRadio] How can I access the FM module by WinRT

    Question

  • Hi all:

        I want to implement a metro style app with FMRadio on ARM platform but I'm not clear which WinRT API I can use.

    (My FMRadio is an onboard module not a dongle.)

    On windows phone, there has one class called "FMRadio class" and it is as a controller for the device radio.

    Does the WinRT support the FMRadio like "FMRadio class" on windows phone?

    If it's negation, is any plan to support it in the future or any substitute?
    Tuesday, April 24, 2012 12:59 AM

Answers

All replies

  • Hi,

    MediaControl class can be used as audio and vedio controller. You can register many interested events.

    Here is sample code.

    mediaControls = Windows.Media.MediaControl;
    
    // Add event listeners for the buttons
    mediaControls.addEventListener(“PlayPressed”, play, false);
    mediaControls.addEventListener(“PausePressed”, pause, false);
    mediaControls.addEventListener(“PlayPauseTogglePressed”, playpausetoggle, false);
    mediaControls.addEventListener(“NextTrackPressed”, nexttrack, false);
    mediaControls.addEventListener(“PreviousTrackPressed”, previoustrack, false);
    mediaControls.addEventListener(“SoundLevelChanged”, soundlevelchanged, false);
    
    // Add code for event handlers for the events
       function play() {
    	     document.getElementById(“audiotag”).play();
       }
    
       function pause() {
    	     document.getElementById(“audiotag”).pause();
       }
       ...
       // Additional code to handle the other events
    
    

    You can use the <audio> tag to easily add audio streaming capabilities to your app. Please refer to Quickstart: adding audio in a Metro style app for more details.

    Here is sample code.

    <audio msAudioCategory="BackgroundCapableMedia" controls="controls"> 
    <source src="mysong.mp3"/> 
    </audio>
    

    Here are more materials for your reference System Transport Controls Developer Guide and Audio Playback in a Metro style App


    Best wishes,


    Robin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 24, 2012 8:58 AM
    Moderator
  • Hi Robin_Yang:

    Thank for your kindly respond.

    I read some of these document once.

    I think it's useful for me with implement about media apps.

    Before I refer others,  there has something I need to make clear.

    If I mistake, please let me know.

    The MediaControl look like to control the media that source from local file.

    Dose it?

    Can it work like the class below?

    http://msdn.microsoft.com/en-us/library/microsoft.devices.radio.fmradio%28v=vs.92%29.aspx

    For example, set the frequency of the FMRadio.

    Can it get the audio stream from hardware and set the configuration to hardware directly?

    The hardware means FMRadio module.

    • Edited by AJ Cheng Wednesday, April 25, 2012 6:27 AM
    Tuesday, April 24, 2012 10:16 AM
  • AJ,

    Were you able to get this to work?

    Best Wishes - Eric


    Wednesday, June 6, 2012 8:09 PM
    Moderator
  • AJ,

    I do not see any method to do this from WinRT.

    Best Wishes - Eric

    Monday, June 11, 2012 10:47 PM
    Moderator