Traffic layer on the map without buttons added

Open in CodeSandbox

You can add a map layer with traffic information. However, you don't have to put the "Traffic" control on the map. You just have to add the corresponding traffic data provider to the map. This example uses the "Current" traffic provider traffic.provider.Actual.

<!DOCTYPE html>
<html>
    <head>
        <title>
            Examples. Traffic layer on the map without buttons added
        </title>
        <meta
            http-equiv="Content-Type"
            content="text/html; charset=UTF-8"
        />
        <!--
        Set your own API-key. Testing key is not valid for other web-sites and services.
        Get your API-key on the Developer Dashboard: https://developer.tech.yandex.ru/keys/
    -->
        <script
            src="https://api-maps.yandex.ru/2.1/?lang=en_RU&amp;apikey=<your API-key>"
            type="text/javascript"
        ></script>
        <script src="traffic_provider.js" type="text/javascript"></script>
        <style>
            html,
            body,
            #map {
                width: 100%;
                height: 100%;
                padding: 0;
                margin: 0;
            }
        </style>
    </head>
    <body>
        <div id="map"></div>
    </body>
</html>
ymaps.ready(init);

function init() {
    var myMap = new ymaps.Map("map", {
        center: [56.136, 40.39],
        zoom: 10,
        controls: [],
    });

    // Creating a "Now" traffic provider with the layer of information points enabled.
    var actualProvider = new ymaps.traffic.provider.Actual(
        {},
        { infoLayerShown: true }
    );
    // And then adding it to the map.
    actualProvider.setMap(myMap);

    /**
     * Removing the provider from the map is also performed through setMap.
     * actualProvider.setMap(null);
     */
}