ovos-media

EXPERIMENTAL - NEW ovos-core version 0.0.8

ovos-media is a work in progress, it does not yet ship with OVOS by default, but it can be manually enabled

In order to use ovos-media you need to enable the OCP pipeline in ovos-core and to disable the old audio service

disabling old audio service

{
  "enable_old_audioservice": false
}

Enabling OCP pipeline

{
  // Intent Pipeline / plugins config
  "intents" : {
    // the pipeline is a ordered set of frameworks to send an utterance too
    // if one of the frameworks fails the next one is used, until an answer is found
    "pipeline": [
        "converse",
        "ocp_high",
        "...",
        "common_qa",
        "ocp_medium",
        "...",
        "ocp_fallback",
        "fallback_low"
    ]
  }
}

OCP

OCP stands for OpenVoiceOS Common Play, it is a full-fledged media player service that can handle audio and video

DEPRECATION WARNING OCP is in the process of migrating from a audio plugin to ovos-media service, this documentation is not valid for ovos-core version 0.0.7

OCP provides a pipeline component specialized in matching media queries.

The pipeline classifies the media type (movie, music, podcast...) and queries OCP skills for results, you can read more about the OCP Pipeline docs

Architecture

imagem

Media Intents

Before regular intent stage, taking into account current OCP state (media ready to play / playing)

  • "play {query}"
  • "previous" (media needs to be loaded)
  • "next" (media needs to be loaded)
  • "pause" (media needs to be loaded)
  • "play" / "resume" (media needs to be loaded)
  • "stop" (media needs to be loaded)
  • "I like that song" (music needs to be playing)

MPRIS integration

OCP Integrates with MPRIS allows OCP to control external players

imagem

Sync with external players

Via MPRIS OCP can control and display data from external players, if using KDEConnect this includes playback in connected devices

See a demo here

demo video

This also includes voice intents, allowing you for example to voice control spotify

Manage multiple players

If OCP is set to manage external players it will ensure only one of them is playing media at once, if using KDEConnect this includes playback in connected devices

See a demo here (warning: contains black metal)

demo video

Skills Menu

Some skills provide featured_media, you can access these from the OCP menu

Homescreen widget

The homescreen skill that comes pre-installed with OpenVoiceOS also comes with a widget for the OCP framework.

File Browser integration

selected files will be played in OCP

folders are considered playlists

Favorite Songs

You can like a song that is currently playing via GUI and intent "I like that song"

like

Liked songs can be played via intent "play my favorite songs" or GUI

favs

Configuration

under mycroft.conf

{
  // Configure ovos-media service
  // similarly to wakewords, configure any number of playback handlers
  // playback handlers might be local applications or even remote devices
  "media": {

    // order of preference to try playback handlers
    // if unavailable or unable to handle a uri, the next in list is used
    // NB: users may request specific handlers in the utterance

    // keys are the strings defined in "audio_players"
    "preferred_audio_services": ["gui", "vlc", "mplayer", "cli"],

    // keys are the strings defined in "web_players"
    "preferred_web_services": ["gui", "browser"],

    // keys are the strings defined in "video_players"
    "preferred_video_services": ["gui", "vlc"],

    // PlaybackType.AUDIO handlers
    "audio_players": {
        // vlc player uses a headless vlc instance to handle uris
        "vlc": {
            // the plugin name
            "module": "ovos-media-audio-plugin-vlc",

            // friendly names a user may use to refer to this playback handler
            // those will be parsed by OCP and used to initiate
            // playback in the request playback handler
            "aliases": ["VLC"],

            // deactivate a plugin by setting to false
            "active": true
        },
        // command line player uses configurable shell commands with file uris as arguments
        "cli": {
            // the plugin name
            "module": "ovos-media-audio-plugin-cli",

            // friendly names a user may use to refer to this playback handler
            // those will be parsed by OCP and used to initiate
            // playback in the request playback handler
            "aliases": ["Command Line"],

            // deactivate a plugin by setting to false
            "active": true
        },
        // gui uses mycroft-gui natively to handle uris
        "gui": {
            // the plugin name
            "module": "ovos-media-audio-plugin-gui",

            // friendly names a user may use to refer to this playback handler
            // those will be parsed by OCP and used to initiate
            // playback in the request playback handler
            "aliases": ["GUI", "Graphical User Interface"],

            // deactivate a plugin by setting to false
            "active": true
        }
    },

    // PlaybackType.VIDEO handlers
    "video_players": {
        // vlc player uses a headless vlc instance to handle uris
        "vlc": {
            // the plugin name
            "module": "ovos-media-video-plugin-vlc",

            // friendly names a user may use to refer to this playback handler
            // those will be parsed by OCP and used to initiate
            // playback in the request playback handler
            "aliases": ["VLC"],

            // deactivate a plugin by setting to false
            "active": true
        },
        // gui uses mycroft-gui natively to handle uris
        "gui": {
            // the plugin name
            "module": "ovos-media-video-plugin-gui",

            // friendly names a user may use to refer to this playback handler
            // those will be parsed by OCP and used to initiate
            // playback in the request playback handler
            "aliases": ["GUI", "Graphical User Interface"],

            // deactivate a plugin by setting to false
            "active": true
        }
    },

    // PlaybackType.WEBVIEW handlers
    "web_players": {
        // open url in the native browser
        "browser": {
            // the plugin name
            "module": "ovos-media-web-plugin-browser",

            // friendly names a user may use to refer to this playback handler
            // those will be parsed by OCP and used to initiate
            // playback in the request playback handler
            "aliases": ["Browser", "Local Browser", "Default Browser"],

            // deactivate a plugin by setting to false
            "active": true
        },
        // gui uses mycroft-gui natively to handle uris
        "gui": {
            // the plugin name
            "module": "ovos-media-web-plugin-gui",

            // friendly names a user may use to refer to this playback handler
            // those will be parsed by OCP and used to initiate
            // playback in the request playback handler
            "aliases": ["GUI", "Graphical User Interface"],

            // deactivate a plugin by setting to false
            "active": true
        }
    }
  }
}

Troubleshooting

Having trouble getting OCP to run properly and be exposed as an MPRIS media player? Check the following:

  • The DBUS_SESSION_BUS_ADDRESS environment variable is what OCP uses to try to connect to dbus. On an OVOS system it will look something like unix:path=/run/user/1000/bus. To get the right user ID, run id -u.
  • If DBUS_SESSION_BUS_ADDRESS is not set, the next place OCP checks is the DISPLAY environment variable. If this is set and looks similar to the value above, then you can probably exclude DBUS_SESSION_BUS_ADDRESS, but if neither are set then use DBUS_SESSION_BUS_ADDRESS.
  • Make sure your OCP settings in your config file like something like the following, taking note of the dbus_type value:
"media": {
  "dbus_type": "session"
}
  • If your dbus_type is set to system then OCP will still work, but since it requires root privileges to read from the system dbus, external systems or programs without root privileges cannot read the MPRIS data there.

You can confirm if the OCP player is registered with dbus using the following command: dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames

The output should look something like the following, if it is working:

method return time=1691467760.293397 sender=org.freedesktop.DBus -> destination=:1.10 serial=3 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string "org.freedesktop.systemd1"
      string ":1.10"
      string "org.mpris.MediaPlayer2.OCP"
      string ":1.9"
      string ":1.1"
   ]

The important part is the org.mpris.MediaPlayer2.OCP value.

If the above steps do not work, please reach out to the OVOS team on Matrix for assistance.