सुलभता पैटर्न · मीडिया

ऑडियो प्लेयर

असली बटन, एक select और एक स्लाइडर हर कंट्रोल को कीबोर्ड से पहुँच योग्य और स्क्रीन रीडर के लिए नाम वाला बनाते हैं, और जब तक कोई "चलाएँ" न दबाए, कोई आवाज़ शुरू नहीं होती। अध्याय अपनी शुरुआत पर ले जाते हैं और चल रहे अध्याय को aria-current से चिह्नित करते हैं; ट्रांसक्रिप्ट बोली जा रही पंक्ति को उभारता है, उसे ऑडियो के ऊपर घोषित किए बिना।

डब्ल्यूसीएजी मानदंड
6
कीबोर्ड नियम
6
जाँच का तरीक़ा
axe, कीबोर्ड और इंस्पेक्टर

लाइव डेमो

आज़माएँ

इसे माउस, कीबोर्ड या स्क्रीन रीडर से इस्तेमाल करें। साथ का इंस्पेक्टर दिखाता है कि आपके इस्तेमाल के दौरान ब्राउज़र सहायक तकनीक को क्या बताता है: फ़ोकस, स्थिति में बदलाव और घोषणाएँ।

राग घड़ी · एपिसोड 14

घड़ी के चारों ओर चार राग

मीरा अय्यर के साथ · 2 मिनट 20 सेकंड

चलाएँ दबाने पर संगीत आपके ब्राउज़र में बनता है; मीरा के शब्द ट्रांसक्रिप्ट में हैं।

अध्याय

ट्रांसक्रिप्ट

  1. 0:00 [संगीत: सा और प पर मिलाया गया तानपुरे का स्वर]
  2. 0:05 मीरा: राग घड़ी में आपका स्वागत है। मैं मीरा अय्यर हूँ।
  3. 0:10 मीरा: हिंदुस्तानी संगीत में कई राग दिन के किसी समय से जुड़े होते हैं। आज हम चार छोटे वाक्यांशों में घड़ी का पूरा चक्कर लगाएँगे।
  4. 0:20 [संगीत: भैरव, एक धीमा, नीचा वाक्यांश]
  5. 0:28 मीरा: भैरव भोर में गाया जाता है। इसके कोमल रे और कोमल ध इसे गंभीर, प्रार्थना जैसी ध्वनि देते हैं।
  6. 0:40 [वाक्यांश ऊपर के सा तक चढ़ता है, फिर लौट आता है]
  7. 0:50 [संगीत: भीमपलासी, एक उजला, झूमता वाक्यांश]
  8. 0:58 मीरा: भीमपलासी गर्म दोपहर का राग है। यह कोमल ग और कोमल नि पर टिकता है।
  9. 1:08 [धुन म पर ठहरती है, फिर सा पर लौट आती है]
  10. 1:20 [संगीत: यमन, एक खुला, चढ़ता वाक्यांश]
  11. 1:28 मीरा: यमन रात की शुरुआत करता है। इसका तीव्र म इसे उजला और खोजता हुआ सा बनाता है।
  12. 1:40 [लंबे स्वर ऊपर के रे तक चढ़ते हैं और सा पर ठहरते हैं]
  13. 1:50 [संगीत: मालकौंस, एक गहरा, पाँच स्वरों वाला वाक्यांश]
  14. 1:58 मीरा: मालकौंस आधी रात का राग है। इसमें सिर्फ़ पाँच स्वर हैं और रे और प छोड़ दिए जाते हैं।
  15. 2:08 मीरा: यह रही घड़ी। अगले हफ़्ते: मानसून के राग।
  16. 2:14 [तानपुरा धीरे-धीरे थम जाता है]

जावास्क्रिप्ट के बिना डेमो उतना ही काम करता है जितना उसका एचटीएमएल; इंस्पेक्टर के लिए जावास्क्रिप्ट चाहिए।

कीबोर्ड

जिन कुंजियों पर यह काम करता है

हर क्रिया पॉइंटर के बिना काम करती है।

कुंजीयह क्या करती है
EnterयाSpaceचलाएँ पर, चलाता या रोकता है; "15 सेकंड पीछे" या "15 सेकंड आगे" पर, छलाँग लगाता है; किसी अध्याय पर, उसकी शुरुआत पर ले जाता है।
Arrow RightयाArrow Leftसीक स्लाइडर पर, 5 सेकंड आगे या पीछे। आवाज़ के स्लाइडर पर, तेज़ या धीमी।
Page UpयाPage Downसीक स्लाइडर पर, 15 सेकंड आगे या पीछे।
HomeयाEndसीक स्लाइडर पर, एपिसोड की शुरुआत या अंत।
Spaceसीक स्लाइडर पर, चलाता या रोकता है, और बताता है कि क्या हुआ।
Arrow DownयाArrow Upगति वाले select पर, धीमी या तेज़ गति चुनता है।

स्क्रीन रीडर

यह क्या घोषित करता है

मार्कअप की भूमिकाओं, नामों और स्थितियों से लिखा गया।

कबअपेक्षित घोषणा
Tab प्लेयर में पहुँचता हैघड़ी के चारों ओर चार राग, समूह। सीक, स्लाइडर, 2 मिनट 20 सेकंड में से 0 सेकंड
फ़ोकस चलाएँ पर पहुँचता हैचलाएँ, बटन
सीक स्लाइडर पर Page Up15 सेकंड
सीक स्लाइडर पर Spaceचल रहा है
फ़ोकस अभी चल रहे अध्याय पर पहुँचता है0:20 भैरव, भोर में, बटन, मौजूदा
ट्रांसक्रिप्ट अगली पंक्ति पर जाता हैकुछ नहीं: उभार सिर्फ़ दिखने के लिए है
एपिसोड ख़त्म होता हैएपिसोड पूरा हुआ

ये अपेक्षित घोषणाएँ हैं, रिकॉर्डिंग नहीं। स्क्रीन रीडर और ब्राउज़र के हिसाब से शब्द और क्रम बदलते हैं।

कोड

कोड कॉपी करें

वही फ़ाइलें जिन पर यह डेमो चलता है। स्टाइल एक प्रीफ़िक्स के साथ परोसी जाती हैं जो इस साइट की अपनी स्टाइल को डेमो से दूर रखता है; आप जो कॉपी करते हैं वह मूल है।

मार्कअप

<div class="ap-audio" data-ap-audio-player>
  <div class="ap-audio__player" role="group" aria-labelledby="aud-name" data-aud-player>
    <div class="ap-audio__top">
      <svg class="ap-audio__cover" viewBox="0 0 96 96" aria-hidden="true" focusable="false">
        <rect width="96" height="96" rx="14" fill="#1E1B4B"/>
        <path d="M48 18a30 30 0 0 1 30 30H48z" fill="#F59E0B"/>
        <path d="M78 48a30 30 0 0 1-30 30V48z" fill="#FDE68A"/>
        <path d="M48 78a30 30 0 0 1-30-30h30z" fill="#F472B6"/>
        <path d="M18 48a30 30 0 0 1 30-30v30z" fill="#6366F1"/>
        <circle cx="48" cy="48" r="17" fill="#1E1B4B"/>
        <path d="M48 48V36M48 48l8 5" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round"/>
        <circle cx="48" cy="48" r="2.6" fill="#FFFFFF"/>
      </svg>
      <div class="ap-audio__id">
        <p class="ap-audio__show">The Raag Clock · Episode 14</p>
        <h3 class="ap-audio__name" id="aud-name">Four raags round the clock</h3>
        <p class="ap-audio__by">With Meera Iyer · 2 minutes 20 seconds</p>
      </div>
    </div>

    <div class="ap-audio__seekrow">
      <span class="ap-audio__time" aria-hidden="true" translate="no" data-aud-now>0:00</span>
      <div class="ap-audio__seek" role="slider" tabindex="0" aria-label="Seek" aria-valuemin="0" aria-valuemax="140" aria-valuenow="0" aria-valuetext="0 seconds of 2 minutes 20 seconds" data-aud-seek>
        <span class="ap-audio__rail"><span class="ap-audio__fill"></span></span>
        <span class="ap-audio__marks" aria-hidden="true" data-aud-marks></span>
        <span class="ap-audio__knob"></span>
      </div>
      <span class="ap-audio__time" aria-hidden="true" translate="no">2:20</span>
    </div>

    <div class="ap-audio__controls">
      <div class="ap-audio__rate">
        <label class="ap-audio__rate-label" for="aud-rate">Speed</label>
        <select class="ap-audio__select" id="aud-rate" data-aud-rate>
          <option value="0.75">0.75×</option>
          <option value="1" selected>1×</option>
          <option value="1.25">1.25×</option>
          <option value="1.5">1.5×</option>
          <option value="2">2×</option>
        </select>
      </div>
      <div class="ap-audio__transport">
        <button type="button" class="ap-audio__btn ap-audio__btn--skip" aria-label="Back 15 seconds" data-aud-skip="-15"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4.5 12a7.5 7.5 0 1 0 2.2-5.3M4.5 4v4.5H9"/><text x="12" y="15.4" text-anchor="middle">15</text></svg></button>
        <button type="button" class="ap-audio__btn ap-audio__btn--play" aria-label="Play" data-aud-play>
          <svg class="ap-audio__i-play" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M8 5.5v13l11-6.5z"/></svg>
          <svg class="ap-audio__i-pause" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M7.5 5h3.2v14H7.5zM13.3 5h3.2v14h-3.2z"/></svg>
        </button>
        <button type="button" class="ap-audio__btn ap-audio__btn--skip" aria-label="Forward 15 seconds" data-aud-skip="15"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M19.5 12a7.5 7.5 0 1 1-2.2-5.3M19.5 4v4.5H15"/><text x="12" y="15.4" text-anchor="middle">15</text></svg></button>
      </div>
      <div class="ap-audio__sound">
        <button type="button" class="ap-audio__btn ap-audio__btn--mute" aria-pressed="false" aria-label="Mute" data-aud-mute>
          <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M11 5 6.5 9H3v6h3.5L11 19z"/><path class="ap-audio__waves" d="M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13"/><path class="ap-audio__cross" d="m16 9.5 5 5m0-5-5 5"/></svg>
        </button>
        <input class="ap-audio__volume" type="range" min="0" max="100" step="5" value="80" aria-label="Volume level" aria-valuetext="80%" data-aud-volume />
      </div>
    </div>
    <p class="ap-audio__note">The music is made in your browser when you press Play; Meera's words are in the transcript.</p>
  </div>

  <div class="ap-audio__more">
    <div class="ap-audio__panel">
      <h4 class="ap-audio__h" id="aud-chapters">Chapters</h4>
      <ol class="ap-audio__chapters" aria-labelledby="aud-chapters">
          <li><button type="button" class="ap-audio__chapter" data-aud-chapter data-at="0" aria-current="true"><span class="ap-audio__ct" translate="no">0:00</span><span class="ap-audio__cn">Tuning up</span><svg class="ap-audio__eq" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M3 13V7M8 13V3M13 13V9"/></svg></button></li>
          <li><button type="button" class="ap-audio__chapter" data-aud-chapter data-at="20"><span class="ap-audio__ct" translate="no">0:20</span><span class="ap-audio__cn">Bhairav, at dawn</span><svg class="ap-audio__eq" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M3 13V7M8 13V3M13 13V9"/></svg></button></li>
          <li><button type="button" class="ap-audio__chapter" data-aud-chapter data-at="50"><span class="ap-audio__ct" translate="no">0:50</span><span class="ap-audio__cn">Bhimpalasi, in the afternoon</span><svg class="ap-audio__eq" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M3 13V7M8 13V3M13 13V9"/></svg></button></li>
          <li><button type="button" class="ap-audio__chapter" data-aud-chapter data-at="80"><span class="ap-audio__ct" translate="no">1:20</span><span class="ap-audio__cn">Yaman, at dusk</span><svg class="ap-audio__eq" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M3 13V7M8 13V3M13 13V9"/></svg></button></li>
          <li><button type="button" class="ap-audio__chapter" data-aud-chapter data-at="110"><span class="ap-audio__ct" translate="no">1:50</span><span class="ap-audio__cn">Malkauns, at midnight</span><svg class="ap-audio__eq" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M3 13V7M8 13V3M13 13V9"/></svg></button></li>
      </ol>
    </div>
    <div class="ap-audio__panel">
      <h4 class="ap-audio__h" id="aud-transcript">Transcript</h4>
      <div class="ap-audio__script" role="region" aria-labelledby="aud-transcript" tabindex="0" data-aud-transcript>
        <ol class="ap-audio__lines">
            <li data-start="0" data-end="5"><span class="ap-audio__lt" translate="no">0:00</span> <span class="ap-audio__line">[Music: a tanpura drone, tuned to Sa and Pa]</span></li>
            <li data-start="5" data-end="10"><span class="ap-audio__lt" translate="no">0:05</span> <span class="ap-audio__line"><b>Meera:</b> Welcome to The Raag Clock. I'm Meera Iyer.</span></li>
            <li data-start="10" data-end="20"><span class="ap-audio__lt" translate="no">0:10</span> <span class="ap-audio__line"><b>Meera:</b> In Hindustani music, many raags belong to a time of day. Today we go round the clock in four short phrases.</span></li>
            <li data-start="20" data-end="28"><span class="ap-audio__lt" translate="no">0:20</span> <span class="ap-audio__line">[Music: Bhairav, a slow, low phrase]</span></li>
            <li data-start="28" data-end="40"><span class="ap-audio__lt" translate="no">0:28</span> <span class="ap-audio__line"><b>Meera:</b> Bhairav is sung at dawn. Its flattened second and sixth notes give it a grave, prayerful sound.</span></li>
            <li data-start="40" data-end="50"><span class="ap-audio__lt" translate="no">0:40</span> <span class="ap-audio__line">[The phrase climbs to the upper Sa, then settles back]</span></li>
            <li data-start="50" data-end="58"><span class="ap-audio__lt" translate="no">0:50</span> <span class="ap-audio__line">[Music: Bhimpalasi, a brighter, swaying phrase]</span></li>
            <li data-start="58" data-end="68"><span class="ap-audio__lt" translate="no">0:58</span> <span class="ap-audio__line"><b>Meera:</b> Bhimpalasi is for the hot afternoon. It leans on the flattened third and seventh.</span></li>
            <li data-start="68" data-end="80"><span class="ap-audio__lt" translate="no">1:08</span> <span class="ap-audio__line">[The melody lingers on Ma, then falls home to Sa]</span></li>
            <li data-start="80" data-end="88"><span class="ap-audio__lt" translate="no">1:20</span> <span class="ap-audio__line">[Music: Yaman, an open, rising phrase]</span></li>
            <li data-start="88" data-end="100"><span class="ap-audio__lt" translate="no">1:28</span> <span class="ap-audio__line"><b>Meera:</b> Yaman opens the night. Its sharp fourth, tivra Ma, makes it sound bright and searching.</span></li>
            <li data-start="100" data-end="110"><span class="ap-audio__lt" translate="no">1:40</span> <span class="ap-audio__line">[Long notes climb to the upper Re and rest on Sa]</span></li>
            <li data-start="110" data-end="118"><span class="ap-audio__lt" translate="no">1:50</span> <span class="ap-audio__line">[Music: Malkauns, a deep, five-note phrase]</span></li>
            <li data-start="118" data-end="128"><span class="ap-audio__lt" translate="no">1:58</span> <span class="ap-audio__line"><b>Meera:</b> Malkauns belongs to midnight. It uses only five notes and leaves out Re and Pa.</span></li>
            <li data-start="128" data-end="134"><span class="ap-audio__lt" translate="no">2:08</span> <span class="ap-audio__line"><b>Meera:</b> That's the clock. Next week: the monsoon raags.</span></li>
            <li data-start="134" data-end="140"><span class="ap-audio__lt" translate="no">2:14</span> <span class="ap-audio__line">[The tanpura fades out]</span></li>
        </ol>
      </div>
    </div>
  </div>

  <p class="ap-audio__vh" role="status" data-aud-status></p>
</div>

डब्ल्यूसीएजी 2.2

यह किन मानदंडों को पूरा करता है

वे सफलता मानदंड जिनका यह पैटर्न ध्यान रखता है, और कैसे।

  • 1.2.1 केवल-ऑडियो और केवल-वीडियो (पहले से रिकॉर्ड किया गया) स्तर A

    जो लोग एपिसोड सुन नहीं सकते, उनके लिए पूरा ट्रांसक्रिप्ट शब्द देता है और संगीत का वर्णन करता है।

  • 1.4.2 ऑडियो नियंत्रण स्तर A

    लोड होने पर कुछ नहीं चलता: AudioContext चलाएँ के पहली बार दबाने पर बनता है, और म्यूट और आवाज़ हमेशा उसके पास रहते हैं।

  • 2.1.1 कीबोर्ड स्तर A

    हर कंट्रोल बटन, select या स्लाइडर है, और सीक स्लाइडर ऐरो कुंजियों, Page Up, Page Down, Home और End को जवाब देता है।

  • 2.2.2 रोकें, बंद करें, छिपाएं स्तर A

    ट्रांसक्रिप्ट सिर्फ़ एपिसोड चलते समय आगे बढ़ता है, जिसे रोकें बंद कर देता है, और कभी नहीं जब पॉइंटर, फ़ोकस या स्क्रॉल उसके अंदर हो।

  • 4.1.2 नाम, भूमिका, मान स्तर A

    चलाएँ का नाम बदलकर रोकें हो जाता है, म्यूट में aria-pressed है, चल रहे अध्याय में aria-current है, और सीक स्लाइडर का मान शब्दों में है।

  • 4.1.3 स्टेटस मैसेज स्तर AA

    स्लाइडर से चलाना और रोकना, और एपिसोड का अंत, फ़ोकस हिलाए बिना एक स्टेटस मैसेज में घोषित होते हैं।

उपयोग

इसे कब इस्तेमाल करें

इसे अपनाएँ

  • पॉडकास्ट, इंटरव्यू, रिकॉर्ड किए व्याख्यान और पाठ, ख़ासकर लंबे, जिन्हें अध्याय चाहिए।
  • बोलचाल वाला ऑडियो: ट्रांसक्रिप्ट वह विकल्प है जिस पर सुन न सकने वाले लोग निर्भर हैं।

कुछ और इस्तेमाल करें

  • छोटा साउंड इफ़ेक्ट या नमूना: controls वाला नेटिव audio एलिमेंट काफ़ी है।
  • पृष्ठभूमि संगीत: उसे न जोड़ें, या दिखते रोकें बटन के साथ म्यूट से शुरू करें, जैसा चलती सामग्री वाले पैटर्न में है।
  • वीडियो: वीडियो प्लेयर पैटर्न इस्तेमाल करें, जो कैप्शन जोड़ता है।

आम विफलताएँ

आमतौर पर यह कहाँ गलत होता है

  • लोड होते ही शुरू होने वाला ऑडियो

    अपने आप चलने वाली आवाज़ स्क्रीन रीडर को दबा देती है। 1.4.2 के तहत तीन सेकंड से लंबी किसी भी चीज़ को रोकने या आवाज़ का कंट्रोल चाहिए, और कहे जाने तक चुप रहना इससे भी बेहतर है।

  • हर पंक्ति घोषित करने वाला ट्रांसक्रिप्ट

    ट्रांसक्रिप्ट पर लाइव रीजन हर पंक्ति को ख़ुद ऑडियो के ऊपर पढ़कर सुनाता है। मौजूदा पंक्ति को दिखाकर उभारें और रीजन को शांत रहने दें।

  • पाठक से उलझने वाला ट्रांसक्रिप्ट

    जब कोई ऊपर पढ़ रहा हो, तब अपने आप स्क्रॉल होना उसके नीचे से पेज खींच लेता है। यह तब रुकता है जब पॉइंटर, फ़ोकस या स्क्रॉल उसके अंदर हो।

  • ऐसे अध्याय जो कंट्रोल नहीं हैं

    सादे टेक्स्ट में लिखे समय सक्रिय नहीं किए जा सकते। यहाँ हर अध्याय सही जगह ले जाने वाला बटन है, और चल रहे अध्याय पर aria-current है।

  • आइकन के भरोसे नाम वाले छलाँग बटन

    "15" या एक मुड़ा तीर कुछ नहीं बताता। "15 सेकंड पीछे" और "15 सेकंड आगे" बताते हैं।

नोट्स

इसे बनाना

  • प्लेयर सिर्फ़ मीडिया एलिमेंट का इंटरफ़ेस इस्तेमाल करता है: currentTime, play(), pause(), volume, muted, playbackRate और उनके इवेंट। असली फ़ाइल के साथ उसे audio एलिमेंट की ओर इंगित करें; Episode यहाँ सिर्फ़ उसकी जगह खड़ा है।
  • AudioContext उसी क्लिक या कुंजी हैंडलर के अंदर बनाएँ जो प्लेबैक शुरू करता है। ब्राउज़र वैसे भी यूज़र की किसी क्रिया के बिना उसे शुरू नहीं करते, और इससे 1.4.2 का पालन पक्का रहता है।
  • aria-current चल रहे अध्याय को हर उस व्यक्ति के लिए चिह्नित करता है जो उस तक पहुँचे, लेकिन किसी दूसरे एलिमेंट पर aria-current का बदलना घोषित नहीं होता, जो ऑडियो चलते समय सही है।
  • ट्रांसक्रिप्ट रीजन में tabindex="0" है ताकि कीबोर्ड यूज़र उसे स्क्रॉल कर सकें, और उसका नाम उसकी हेडिंग से आता है।
  • गति एक नेटिव select है: ऐरो कुंजियाँ, टाइप करके खोजना और स्क्रीन रीडर सपोर्ट उसमें मुफ़्त मिलते हैं।

स्रोत: WAI-एआरआईए ऑथरिंग प्रैक्टिसेज़: मीडिया सीक स्लाइडर · W3C WAI: ट्रांसक्रिप्ट · MDN: Web Audio एपीआई के अच्छे तरीक़े

लाइट और डार्क थीम में, डेस्कटॉप और फ़ोन की चौड़ाई पर axe से और कीबोर्ड से जाँचा गया। अभी हर स्क्रीन रीडर और ब्राउज़र जोड़ी के साथ नहीं परखा गया। सुधार बताएँ