grav-plugin-mediaembed icon indicating copy to clipboard operation
grav-plugin-mediaembed copied to clipboard

Soundcloud params don't seem to be working

Open akoebbe opened this issue 8 years ago • 1 comments

I've tried setting the following params settings for Soundcloud, but none of them seem to have any effect...

services:
  SoundCloud:
    enabled: true           # Set to false to disable this service completely
    type: "rich"            # Type of the media service

    example: "https://soundcloud.com/semiseria/verruckert-ausschnitt"

    # URL of media service used for embedding
    url: "w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/{:id}"

    # Canonical URL of media service (used in endpoint calls)
    canonical: "http://soundcloud.com/{:id}"

    # Endpoint to grab media informations
    endpoint: "http://soundcloud.com/oembed?url={:canonical}&format=json"

    # Schemes to grab media id
    schemes:
      - "soundcloud.com/*"
      - "soundcloud.com/*/*"
      - "soundcloud.com/*/sets/*"
      - "soundcloud.com/groups/*"
      - "snd.sc/*"

    params:
      auto_play: true
      buying: true
      download: true
      hide_related: false
      liking: true
      sharing: true
      show_artwork: false
      show_comments: false
      show_playcount: false
      show_user: false
      visual: false

The outputted iframe src is always: https://w.soundcloud.com/player/?visual=true&url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F142154374&show_artwork=true

akoebbe avatar Sep 06 '15 21:09 akoebbe

This is because Rich type Media are currently poorly implemented and doesn't allow setting parameters for the moment (see https://github.com/Sommerregen/grav-plugin-mediaembed/blob/master/classes/OEmbed/OEmbedRich.php#L53). The reason is due to the lack that the specification for rich type media is very unclear (there exists no URL field). Thus I roughly implemented a way to grab at least the correct URL of that media directly from the iframe.

However you are right. Supporting custom param options may be possible be parsing that URL and injecting those params one defines in the mediaembed.yaml.

I will have a look and see whether I can implement such a feature without rewriting too much of the code.

Sommerregen avatar Sep 07 '15 08:09 Sommerregen