Search code examples
javascriptgoogle-apigoogle-picker

Google Picker ViewId for mp3 files


I am trying to get the Google Picker to let the user select only mp3 files. I have looked at the documentation for Picker but didn't see any info what the ViewID should be for Mp3 files. Also, trying to show all the files with addView(google.picker.ViewId.DOCS). isn't working. Does someone know how to load just .mp3's or all the files? Thanks!


Solution

  • There's no 'load just the mp3 files' as far as I've tested but there's 'load all files which includes mp3s'.

    Just follow the Picker API Quickstart code and change these parts:

    FROM

    var scope = 'https://www.googleapis.com/auth/photos'
    

    TO

    var scope = 'https://www.googleapis.com/auth/drive';
    

    (in createPicker().. ) FROM

    addView(google.picker.ViewId.PHOTOS).
    

    TO

    addView(google.picker.ViewId.DOCS).
    

    and then when the picker selector appears, you can type .mp3 and in the search box and it'll show all the mp3 files.

    See screenshot below: enter image description here