How to set the Volume on the media player in QML

Hello

I would like to adjust the volume of my QML Media Player object. According to the documentation:

http://developer.BlackBerry.com/native/reference/Cascades/bb__multimedia__mediaplayer.html

MediaPlayer class has a setVolume method, but I get:

TypeError: Result of expression 'myPlayer.setVolume' [undefined] is not a function.

How can I adjust the volume in QML?

Hi burakk,

Here are the steps that you must follow to adjust the volume by QML programming:

(1) define a signal myVolumeChanged to the main control QML

(2) define a slot that handles the signal preceding once it is triggered by the volume control of the MediaPlayer with the new volume

(3) fire this signal into the slots of the buttons onClicked two volume

I tried the above using the nowplaying waterfalls sample app and were able to achieve what you're trying to do, which is affecting the volume of the MediaPlayer using two buttons volume QML. Here's the code I added in the file main.qml from the sample application for your reference:

import bb.cascades 1.2
import bb.multimedia 1.0

Page {
    property double newVolume: 4
    signal myVolumeChanged()

    onMyVolumeChanged: {
        player.setVolume(newVolume);
    }

    Container {
        layout: DockLayout {}

        ImageView {
            ...
        }

        Label {
            ...
        }

        //! [1]
        ProgressBar {
               ....
        }
        //! [1]

        Container {
            layout: StackLayout {
                orientation: LayoutOrientation.LeftToRight
            }

            Button {
                text: "Increase Volume"
                onClicked: {
                    newVolume = newVolume + 1
                    myVolumeChanged();
                }
            }
            Button {
                text: "Decrease Volume"
                onClicked: {
                    newVolume = newVolume - 1
                    myVolumeChanged();
                }
            }
        }
    }

    attachedObjects: [
        //! [2]
        MediaPlayer {
            id: player

            sourceUrl: "music/song.mp3"
        },
        //! [2]

        //! [3]
        NowPlayingConnection {
            id: nowPlaying
            ...

        }
        //! [3]
    ]
}

Tags: BlackBerry Developers

Similar Questions

  • How to set the media of paper trays if you have the optional tiroir2 on 8600 Officejet printers

    Follow the steps below to correctly configure your paper trays.

    1. tap (right arrow), press Setup, tap Preferences, and then select default tray

    2. Select tray 2 as the default tray

    3. open Printers and faxes

    4 right-click the printer, and then click printer properties

    5. click on the device settings tab

    6. on the screen set the media type you assigned to each tray (example: Tray 1 - envelopes & tray 2 - letter)

    7. click apply, then Ok

    8. When you have an envelope, you print it can pull out of tray 1

    9. When you have a letter that you print it will pull from tray 2

    Hi xor42,

    Follow the steps below to correctly configure your paper trays.

    1. tap (right arrow), press Setup, tap Preferences, and then select default tray

    2. Select tray 2 as the default tray

    3. open Printers and faxes

    4 right-click the printer, and then click printer properties

    5. click on the device settings tab

    6. on the screen set the media type you assigned to each tray (example: Tray 1 - envelopes & tray 2 - letter)

    7. click apply, then Ok

    8. When you have an envelope, you print it can pull out of tray 1

    9. When you have a letter that you print it will pull from tray 2

  • How to change the media player by default

    Windos Media Player/Real Player

    Now when I play a radio episode old days of the Internet, it is default to iTunes, and I want the default for RealPlayer or Windows Media Player, so I can move the flag past the boring parts.  I can find is no longer a menu OPEN a URL to click on paste the URL of the episode of radio old time.  Where did you hide it?  I wish you stop the upgrade of these things and let the only interfaces!

    So I guess that the problem is solved? If you want to change the association, you can set all the elements containing MP3s to always ask in the Applications Panel. Then, the next time you click on an MP3 link, you should be able to select the application you want to open it with.

  • How to get the Media Player 12 to support id3v2.4 tags either directly or indirectly using a 3rd party plugin.

    original title: id3v2.4 MP3 tags

    Hello

    someone knows how to get Media Player 12 to support id3v2.4 tags, either directly, or indirectly using a 3rd party plugin. I use a program (Traktor Pro) which is a djing software. It reads my music library and writes specific tags such as BPM id3v2.4 format for MP3 files. After that, WMP cannot display MP3 tags because it seems that you can not read this latest version of id3 standard (which incidentally seems to be interrupted since 2000). End result is that any MP3 in the library seem to be corrupted / lack of tags in WMP12 after being accessed by Traktor Pro

    See you soon

    Shane

    Mr. Gonk,

    WMP and WE can read mp3 2.4 tags but can not write them.

    ERGO WMP works with 2.4 tags. So where is the problem?  Personally I use a 3rd party editor to write tags (more powerful and you can do more things).

    My 2 Euro cents

    See you soon,.

    Jerry

  • HP Jet 7: How to stop the media player playing the next song

    I sing and I want a media player that does not automaticlly jump to the next song on my playlist

    I don't know if it will be what you're looking for exactly, but VLC Media Player will do what you describe.

    Once installed, go to Tools/Preferences.

    Select the Interface tab

    In the section of the Playlist, click the box for "break on the last frame of a video.

    Save

    Go to the media and add a file similar to Windows Media Player.

    Go to view and click Show playlist. Then the arrow above the playlist Display Mode, then choose detailed display.

    Start playback of the video or audio of first file (works for one).

    It is paused when the end is reached

    To move to the next video, press n for the next.

    Hit the key corresponding to the previous p.

    It will be useful.

  • How to share the Media Player library on a computer on the network

    Original title: network and sharing of library

    Hello!!  Why doesn´t my library of hole windows mediaplayer with music from my home computers appear on my networkcomputer I get only a tiny part of it

    Hi VivekaNelson,
     
    -What is the operating system that runs on the computer on the network?
    -What version of Media Player is running on your computer at home?
     
    If you use Windows Media Player 11 for Windows XP, follow the steps in the article below and check if you can share the library together without any problem.
  • setting the parental control on the volume on the media player control is possible?

    my daughter is maxing out the volume on windows media player using headsets is it a parental control on the volume controls

    Hello

    Unfortunately there is not this setting in Windows media player, but there could be some third-party programs that will help you accomplish your task. You can search for programs using your favorite search engine and check.

    Note: This response contains a reference to third party World Wide Web site. Microsoft provides this information as a convenience to you. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there. There are the dangers inherent in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    However, you can post your suggestion in the link mentioned below so that we can improve Microsoft Products.

    https://Connect.Microsoft.com/continue.aspx?PAGETYPE=2®Type=2&cru=%2fdashboard%2F%3fwa%3dwsignin1.0&cu=

    Thanks and regards.

    Thahaseena M
    Microsoft Answers Support Engineer.
    Visit ourMicrosoft answers feedback Forum and let us know what you think.

  • How to set the HostDiskPartitionAttributes property when creating Vmfs volume

    Hi all

    When creating vmfs datastore through vlume

    programmatically, I need to partition the vmfs volume. here my question

    is an idea how to set the HostDiskPartitionAttributes there is a

    parameter to create vmfs vloume. Here I use Vdisk lun san

    "that will have the size, raid, stripesize... by this I need to set this.

    HostDiskPartitionAttributes ' property.could someone help me please. "

    Note: it's links to the document:

    http://www.VMware.com/support/developer/VC-SDK/visdk25pubs/ReferenceGuide/index.html

    is the method that you need to find CreateVmfsDatastore.

    Thank you

    As partition is a contiguous series of blocks on a disk that is marked to be used and is considered in each sector of 512 bytes. Must divide the space into sectors and specify startSector and endSector according to your requirement, that the way in which large partition you want to create.

  • How to set the storage space allocated to the restoration of the system to 200 MB?

    Could you tell me how to set the maximum storage limit to 200 MB?

    Whenever I have delete system restore points, my hard disk free space increases about 10%.  About a week or so later, it's back to where it was before I deleted the restore points.

    It is very important for me because I am sure that storage space is set too high.

    Hello

    See the "BOLD" marked links with more information to help.

    Phantom memory also holds your restore VSSadmin points it defines parameters.

    How to create a Vista System Restore Point
    http://www.Vistax64.com/tutorials/76332-system-restore-point-create.html

    How to make a Vista system restore
    http://www.Vistax64.com/tutorials/76905-System-Restore-how.html
    How to turn System Restore on or off in Vista
    http://www.Vistax64.com/tutorials/66971-system-restore.html

    Adjustment of the amount of disk space, System Restore uses for restore points
    http://bertk.MVPs.org/html/diskspacev.html

    How to change how much Space System Restore can use
    http://www.Vistax64.com/tutorials/76227-system-restore-disk-space.html
    http://www.Petri.co.il/change_amount_of_disk_space_used_by_system_restore_in_vista.htm

    ShadowStorage vssadmin commands
    http://TechNet.Microsoft.com/en-us/library/cc755866 (WS.10) .aspx
    http://technet2.Microsoft.com/WindowsServer/en/library/89d2e411-6977-4808-9AD5-476c9eaecaa51033.mspx?mfr=true

    Guide to Windows Vista system restore
    http://www.bleepingcomputer.com/tutorials/tutorial143.html

    Expiration errors occur in Volume Shadow Copy service writers, and shadow copies are lost during
    backup and at the time when there are high levels of input/output
    http://support.Microsoft.com/?ID=826936

    A good utility:

    Explorer of the shadow - free
    http://www.ShadowExplorer.com/

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • How to set the font size of the title to different screens in fluid layout?

    Build a fluid layout (Responsive Web design), and could I please know how to set the font size of title (h1, h2, h3 etc.) and other mobile police, tab size and wallpapers?

    I use no px values.  I generally use the % font size in the selector body inside my queries.  Adjust the dimensions accordingly.

    / Special rules for mobile phones. */

    @media only screen and (max-width: 481px) {}

    Body {size are: 85 %}}

    }

    / Special rules for tablets * /.

    @media only screen and (min-width: 482px) {}

    Body {make-size: 100% ;}}

    }

    / * Special rules that apply to workstations * /.

    @media only screen and (min-width: 1050px) {}

    Body {make-size: 135% ;}}

    }

    Nancy O.

  • How to set the number of e-mail messages that are stored on my iPhone

    How to set the number of e-mail messages that are stored on my iPhone – so when I don't have a network connection I can see a 'large' number of messages in my Inbox etc.

    This is series is not defined in the world

    You must go to settings-> mail, contacts, and calendars and check the settings of your e-mail provider offers in this area

  • How to set the time that my screen stays on?

    How to set the time that my screen lights up.  I have an iPod Touch 6?

    Settings > general > auto-lock

  • How to set the default android home page.

    How to set the home page in the latest browser of firefox for android?

    Hello:

    Unfortunately you can not remove the top sites home page but you can pin a site, remove a site from unpin it and change the url of a pinned site.

    Please read this article for instructions.

    I hope this helps!

  • How to set the time between slides in a slideshow (iPhoto, el capitan)

    How to set the time to say - 5 seconds or 20 seconds - between slide show photos in iPhoto. I use el capitan.

    See the Settings button at the bottom right of the toolbar (at the bottom of the slide show). Click on it and you have a small window with two tabes, refers to all the slides, the other to the selected slide. You can make your choice

  • Satellite C660 - how to set the focus of the webcam?

    Hello

    Just bought this laptop, the built-in webcam looks very blurry when I use Skype. Does anyone know how to set the focus to the subject?

    See you soon
    Jules

    Hello

    to be honest, I have no idea on your model of lap... Try to update driver webcamd and play with Skype video settings.

Maybe you are looking for