{"id":28407758,"url":"https://github.com/servo/media","last_synced_at":"2026-03-11T03:04:03.742Z","repository":{"id":31931940,"uuid":"125494444","full_name":"servo/media","owner":"servo","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-03T23:34:00.000Z","size":6759,"stargazers_count":90,"open_issues_count":59,"forks_count":64,"subscribers_count":19,"default_branch":"main","last_synced_at":"2026-02-04T11:49:58.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/servo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-03-16T09:29:29.000Z","updated_at":"2026-02-03T23:34:02.000Z","dependencies_parsed_at":"2023-02-15T18:46:03.782Z","dependency_job_id":"04df0f8f-1442-4685-ba92-bbbef3370193","html_url":"https://github.com/servo/media","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/servo/media","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fmedia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fmedia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fmedia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fmedia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/servo","download_url":"https://codeload.github.com/servo/media/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Fmedia/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30368638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-02T01:36:53.732Z","updated_at":"2026-03-11T03:04:03.736Z","avatar_url":"https://github.com/servo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Servo Media\n\n[![Build Status](https://github.com/servo/media/actions/workflows/rust.yml/badge.svg)](https://github.com/servo/media/actions)\n\nThe `servo-media` crate contains the backend implementation to support all [Servo](https://github.com/servo/servo) multimedia related functionality. This is:\n  - the [HTMLMediaElement](https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement) and the `\u003caudio\u003e` and `\u003cvideo\u003e` elements.\n  - the [WebAudio API](https://webaudio.github.io/web-audio-api).\n  - the [WebRTC API](https://w3c.github.io/webrtc-pc/).\n  - the [Media Capture and Streams APIs](https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo-groupid).\n\n`servo-media` is supposed to run properly on Linux, macOS, Windows and Android. Check the [build](https://github.com/servo/media/tree/f96c33b7374d5b9915b8bae8623723b2d23ec457#build) instructions for each specific platform.\n\n`servo-media` is built modularly from different crates and it provides an abstraction that allows the implementation of multiple media backends. For now, the only functional backend is [GStreamer](https://github.com/servo/media/tree/f96c33b7374d5b9915b8bae8623723b2d23ec457/backends/gstreamer). New backend implementations are required to implement the [Backend](https://github.com/servo/media/blob/2610789d1abfbe4443579021113c822ba05f34dc/servo-media/lib.rs#L33) trait. This trait is the public API that `servo-media` exposes to clients through the [ServoMedia](https://github.com/servo/media/blob/2610789d1abfbe4443579021113c822ba05f34dc/servo-media/lib.rs#L90) entry point. Check the [examples](https://github.com/servo/media/tree/f96c33b7374d5b9915b8bae8623723b2d23ec457/examples) folder to get a sense of how to use it effectively. Alternatively, you can also check how `servo-media` is integrated and used in [Servo](https://github.com/servo/servo). \n\n## Requirements\nSo far the only supported and default backend is\n[GStreamer](https://gstreamer.freedesktop.org/).\nSo in order to build  this crate you need to install all\n[gstreamer-rs](https://github.com/sdroege/gstreamer-rs) dependencies for your\nspecific platform as listed\n[here](https://github.com/sdroege/gstreamer-rs#installation).\n\n### Ubuntu Trusty\nUbuntu Trusty has very old GStreamer packages (1.2, while we need at least 1.16), so you need to [manually build GStreamer \u003e1.16](https://github.com/servo/servo/wiki/How-to-generate-GStreamer-binaries-for-CI) or alternatively run the `etc/ubuntu_trusty_bootstrap.sh` shell script, which downloads a pre-built bundle and sets up the required environment variables:\n\n```ssh\nsource etc/ubuntu_trusty_bootstrap.sh\n```\n\n### Android\nFor Android there are some extra requirements.\n\nFirst of all, you need to install the appropriate toolchain for your target.\nThe recommended approach is to install it through\n[rustup](https://rustup.rs/). Taking `arm-linux-androideabi` as our example\ntarget you need to do:\n\n```bash\nrustup target add arm-linux-androideabi\n```\n\nIn addition to that, you also need to install the Android\n[NDK](https://developer.android.com/ndk/guides/).\nThe recommended NDK version is\n[r16b](https://developer.android.com/ndk/downloads/older_releases). The\nAndroid [SDK](https://developer.android.com/studio/) is not mandatory\nbut recommended for practical development.\n\nOnce you have the Android NDK installed in your machine, you need to create\nwhat the NDK itself calls a\n[standalone toolchain](https://developer.android.com/ndk/guides/standalone_toolchain).\n\n```bash\n $ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \\\n   --platform=android-18 --toolchain=arm-linux-androideabi-4.9 \\\n   --install-dir=android-18-arm-toolchain --arch=arm\n```\n\nAfter that you need to tell Cargo where to find the Android linker and ar,\nwhich is in the standalone NDK toolchain we just created. To do that we\nconfigure the `arm-linux-androideabi` target in `.cargo/config` (or in\n`~/.cargo/config` if you want to apply the setting globaly) with the `linker`\nvalue.\n\n```toml\n[target.arm-linux-androideabi]\nlinker = \"\u003cpath-to-your-toolchain\u003e/android-18-toolchain/bin/arm-linux-androideabi-gcc\"\nar = \"\u003cpath-to-your-toolchain\u003e/android-18-toolchain/bin/arm-linux-androideabi-ar\"\n```\n\nThis crate indirectly depends on\n[libgstreamer_android_gen](https://github.com/servo/libgstreamer_android_gen):\na tool to generate the required `libgstreamer_android.so` library with all\nGStreamer dependencies for Android and some Java code required to initialize\nGStreamer on Android.\n\nThe final step requires fetching or generating this dependency and setting the pkg-config to use\n`libgstreamer_android.so`. To do that, there's a [helper script](etc/android_bootstrap.sh)\nthat will fetch the latest version of this dependency generated for\nServo. To run the script do:\n\n```\ncd etc\n./android_bootstrap.sh \u003ctarget\u003e\n```\n\nwhere `target` can be `armeabi-v7` or `x86`.\n\nAfter running the script, you will need to add the path to the `pkg-config`\ninfo for all GStreamer dependencies to your `PKG_CONFIG_PATH` environment variable\nThe script will output the path and a command suggestion. For example:\n\n```\nexport PKG_CONFIG_PATH=/Users/ferjm/dev/mozilla/media/etc/../gstreamer/armeabi-v7a/gst-build-armeabi-v7a/pkgconfig\n```\n\nIf you want to generate your own `libgstreamer_android.so`\nbundle, check the documentation from that repo and tweak the\n[helper script](https://github.com/servo/media/blob/a9c73680eef72d48f975df55fe9451020e350fad/etc/android_bootstrap.sh#L24) accordingly.\n\n## Build\nFor macOS, Windows, and Linux, simply run:\n```bash\ncargo build\n```\nFor Android, run:\n```bash\nPKG_CONFIG_ALLOW_CROSS=1 cargo build --target=arm-linux-androideabi\n```\n\n## Running the examples\n### Android\nMake sure that you have [adb](https://developer.android.com/studio/command-line/adb)\ninstalled and you have adb access to your\nAndroid device. Go to the `examples/android` folder and run:\n```ssh\nsource build.sh\n./run.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservo%2Fmedia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fservo%2Fmedia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservo%2Fmedia/lists"}