shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.06k stars 1.33k forks source link

Better handling for extra end tags in VTT #3430

Closed pedrosilvabos closed 9 months ago

pedrosilvabos commented 3 years ago

Have you read the Tutorials? YES

Have you read the FAQ and checked for duplicate open issues? YES

What version of Shaka Player are you using? 3.0.10

One of the manifests I have to work with, comes from a live stream, that has subtitles, below i send a resume part of it for better understanding

<MPD>
    <Period>

                 [... shortened]

        <AdaptationSet id="5" group="8" bitstreamSwitching="true" segmentAlignment="true" contentType="subtitle" mimeType="application/mp4" lang="por">
            <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
            <SegmentTemplate timescale="10000000" media="S!d2ELd2Vid2lkZXZpbmVU.v...wGf/QualityLevels($Bandwidth$)/Fragments(por_0=$Time$)" initialization="S!d2ELd2Vid2lkZXZpbmVU.v...wGf/QualityLevels($Bandwidth$)/Fragments(por_0=Init)">
                <SegmentTimeline>
                    <S t="16221291497830370" d="20020000" r="29"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation id="dxFknw.." bandwidth="100" codecs="stpp"/>
        </AdaptationSet>
    </Period>
</MPD>

I work well with other manifests that come like such:

<Period>
    <MPD>

                 [... shortened]

        <AdaptationSet
        contentType="text"
        lang="pt"
        label="Português"
        mimeType="text/vtt">
            <Representation
          id="textstream_pt_0"
          bandwidth="0">
                <BaseURL>sub-f1.vtt</BaseURL>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

This latest one, its very straight forward since the shaka Player detects the subtitles and I can apply them with selectTextTrack.

The first one however, shaka Player does not detect it and at the moment I can't really understand how I can use it. I have read the contentType="subtitle" is wrong and it should be contentType="text"

can someone help ? thank you

theodab commented 3 years ago

You are correct that the contentType being "subtitle" rather than "text" is likely to be the problem. When reading through manifests, we respond to four contentType values: "video", "audio", "text", and "image". I can't say for sure without actually testing your manifest, however.

If you have no control over these ill-formed manifests, you could potentially register a response filter that reads the text, replaces all instances of contentType="subtitle" with contentType="text", and then passes that modified text on. Something like this (note: not thoroughly tested):

player.getNetworkingEngine().registerResponseFilter((type, response) => {
  if (type != shaka.net.NetworkingEngine.RequestType.MANIFEST) {
    return;
  }
  let responseText = shaka.util.StringUtils.fromUTF8(response.data);
  responseText = responseText.split('contentType="subtitle"').join('contentType="text"');
  response.data = shaka.util.StringUtils.toUTF8(responseText);
});

Does this help?

pedrosilvabos commented 3 years ago

It should. I am lucky I am able to talk to the team responsible for the manifest creation. So that I will address that. it is however super interesting that you have shown me a way to manipulate the manifest itself. Should be useful for other events and problems. Thank you and yes, it helped

pedrosilvabos commented 3 years ago

hi again @theodab

The team has changed to contentType="text" Shaka is able to detect the subtitle presence. However nothing is shown, here is a sketch of the subtitle part of the manifest:

 <AdaptationSet id="5" group="8" bitstreamSwitching="true" segmentAlignment="true" contentType="text" mimeType="application/mp4" lang="por">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
      <SegmentTemplate timescale="10000000" media="S!d2ELd2Vid2lkZXZpbmVU.v...wGf/QualityLevels($Bandwidth$)/Fragments(por_0=$Time$)" initialization="S!d2ELd2Vid2lkZXZpbmVU.v...wGf/QualityLevels($Bandwidth$)/Fragments(por_0=Init)">
        <SegmentTimeline>
          <S t="16245419917474360" d="20020000" r="29"/>
        </SegmentTimeline>
      </SegmentTemplate>
      <Representation id="dxFknw.." bandwidth="100" codecs="stpp"/>
    </AdaptationSet>

This seems so different from the regular text file based subtitles. Using the shaka online demo, passing in the manifest url and the drm url the captions seem to work, what leads to understand my implementation is not completely correct my code goes something like this:

const video = document.getElementById('video');
this.shakaVideo = video
this.shakaPlayer = new globalThis['shaka']['Player'](video);
let availableSubtitles = this.shakaPlayer.getTextTracks()

//availableSubtitles is an array with the available subtitles that in this  projects case there is only only element

this.shakaPlayer.selectTextTrack(0)
this.shakaPlayer.setTextTrackVisibility(true)

I leave below a working mpd along with the DRM for the case that the subtitles do not seem to work, altho the DRM will expire in 1 hour so, it is here Azores 8:00pm. I will keep an eye out for a reply and update the links when asked.

Thank you in advance

This works for the subtitle vtt text files on my code, but does not work for this mpd.

MANIFEST URL https://vspp.online.go.oi.com.br/sdash/LIVE$STARHBR/index.mpd/Manifest?start=LIVE&end=END&device=webwidevine&vxttoken=cGF0aFVSST0lMmZzZGFzaCUyZkxJVkUlMjRTVEFSSEJSJTJmaW5kZXgubXBkJTJmKiZleHBpcnk9MTYyNDY1MDkwOCZ4OmlwPTEwLjIwMy4yNC4xOTgsZDYxMmFkNWYyNmY4M2Y5MzRiNTZiZjkzMmExZDM0MjljZDk0NGE1ZDczOGM0MTg3ODhkZTEzYWU5YTMzNDdmZg==

DRM URL: https://oiplaykeydeliveryprod.keydelivery.brazilsouth.media.azure.net/Widevine/?KID=7a806cd3-f6a2-4131-aa97-0e0519123766&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vb2lwbGF5Lm9pLmNvbS5ici8iLCJhdWQiOiJodHRwOi8vb2lwbGF5Lm9pLmNvbS5ici9henVyZW1zLyIsIm5iZiI6MTYyNDU2NDUwOCwiZXhwIjoxNjI0NTc1MzA4LCJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI3YTgwNmNkMy1mNmEyLTQxMzEtYWE5Ny0wZTA1MTkxMjM3NjYifQ.OqGmqdVdt7FQ-w30TXaIVOOf6kTz54811obt1TWmPUM

joeyparrish commented 3 years ago
this.shakaPlayer.selectTextTrack(0)

selectTextTrack takes a track object, not an index. Try using selectTextTrack(availableSubtitles[0]) instead.

pedrosilvabos commented 3 years ago

Yes that made a lot of sense... However to no avail... this is the form of the subtitle object that does not show subtitles: image

this is the for of a subtitle object that works: image

TheModMaker commented 3 years ago

Note that you need to use our UI to see PNG subtitles. When using the non-UI text displayer, we only support text-based subtitles. The easiest way would be to use our UI. Or, I think you can enable the UI text displayer without using the full UI by calling player.setVideoContainer(container) with the <div> element that the <video> element is within. This element should contain the whole video and not be bigger.

shaka-bot commented 3 years ago

@pedrosilvabos Does this answer all your questions? Can we close the issue?

shaka-bot commented 3 years ago

Closing due to inactivity. If this is still an issue for you or if you have further questions, you can ask us to reopen or have the bot reopen it by including @shaka-bot reopen in a comment.

pedrosilvabos commented 3 years ago

@shaka-bot reopen Hi @TheModMaker thank you for the reply and I'm sorry for my late reply, I was out on vacations. We can't (or i believe we cant) use your UI because this is a Smart TV application so it does not directly apply since i can't (or dont know how) to use the controls on the native shaka player UI using a remote control of the TV (Tizen and WebOS)

I understood your answer, and we in fact have regular text subtitles, its just the PNG ones that are not showing or certain manifests.

Does the native UI have some sort of way to be controlled with any other input the the mouse? if so I could try to adapt you UI so it would work in the smartTV with a remote.

thank you

joeyparrish commented 3 years ago

We use our own UI on Chromecast to display status and subtitles, even though it won't be clicked on. You can customize it to show a subset of the normal controls.

However, you can use our UI's subtitle display independently. If you put your video element into a div container, you should be able to do something like:

player = new shaka.Player(video);
player.setVideoContainer(videoContainer);
// Force the player to re-evaluate what the default configs should be,
// so that you get the UI-based text display:
player.resetConfiguration();
// Now do whatever configuration you normally would

Does this work for you?

pedrosilvabos commented 3 years ago

thank you @joeyparrish it should, let me test it out and then post some feedback here.

pedrosilvabos commented 3 years ago

hello, @TheModMaker @joeyparrish After testing what you sent me, I can validate that it does work i can see the text subtitles on manifests that I could already previously see subtitles already, I can't however still make them work with this manifest in particular.

I was told originally that this manifest used PNG subtitles, and that is something that after analysing the manifest itself i debunked (i think) because i see some vtt format subtitles, so I went to the shaka player demo and loaded the manifestUri and the DRM into the custom to and to my surprise what I got this back was: The video loads correctly and the media plays, once I go to the subtitles (it detects I have Portuguese / Brazilian subs), and choose PT-BR, it produces that error and while the media still plays on(whitout subtitles), however it wont play anymore once it tries to rebuffer or you move the timeline.

image

I am not sure what to conclude from here, in one hand I think the manifest has some sort of problem with the subtitles, however this same manifest is used in other platforms currently and it seems to work properly(namely CAF)

On the other hand could there be something extra I am not configuring correctly in shaka ? I have compared the manifest to other contents that are from the same provider and do have subtitles and the subtitle part seems the exact same (minus filenames)

***WORKS
<AdaptationSet id="3" group="3" contentType="text" lang="pt-BR" mimeType="text/vtt" startWithSAP="1">
     <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
     <Representation id="textstream_pt-BR=0" bandwidth="0">
       <BaseURL>1499231__271752_a10e047cb04e41789fd9c25c7912bb31_.vtt</BaseURL>
     </Representation>
   </AdaptationSet>

***DOES NOT WORK
 <AdaptationSet id="3" group="3" contentType="text" lang="pt-BR" mimeType="text/vtt" startWithSAP="1">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <Representation id="textstream_pt-BR=0" bandwidth="0">
        <BaseURL>1498294_e5629c66a99141afbea5b55d4737fdd7_.vtt</BaseURL>
      </Representation>
    </AdaptationSet>

Below I send a the manifest uri of the content in question that does not read the subtitles and fails to load on the demos player once the pt-BR subtitles are loaded, if you please look at it and could maybe identify what could cause this:

<?xml version="1.0" encoding="utf-8"?>
<MPD
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
  xmlns:cenc="urn:mpeg:cenc:2013"
  xmlns:mspr="urn:microsoft:playready"
  xmlns:mas="urn:marlin:mas:1-0:services:schemas:mpd" type="static" mediaPresentationDuration="PT2H10M33.192034S" minBufferTime="PT10S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
  <Period duration="PT2H10M33.192034S">
    <AdaptationSet id="1" group="1" contentType="audio" lang="en" segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1" audioSamplingRate="44100" mimeType="audio/mp4" codecs="mp4a.40.2" startWithSAP="1">
      <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"></AudioChannelConfiguration>
      <!-- Common Encryption -->
      <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="606770F9-4987-5806-A797-B7CDA8CA9E99"></ContentProtection>
      <!-- PlayReady -->
      <ContentProtection schemeIdUri="urn:uuid:9A04F079-9840-4286-AB92-E65BE0885F95" value="MSPR 2.0">
        <cenc:pssh>AAAC5nBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAsbGAgAAAQABALwCPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgArAFgAQgBuAFkASQBkAEoAQgBsAGkAbgBsADcAZgBOAHEATQBxAGUAbQBRAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+ADAAawBoAEkAWQBYAHEANgA5AFIARQA9ADwALwBDAEgARQBDAEsAUwBVAE0APgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAHAAbABhAHkAcgBlAGEAZAB5AC4AZQBuAHQAaQB0AGwAZQBtAGUAbgB0AC4AbgBlAHgAdAAuAHQAaABlAHAAbABhAHQAZgBvAHIAbQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwByAGkAZwBoAHQAcwBtAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==</cenc:pssh>
        <mspr:IsEncrypted>1</mspr:IsEncrypted>
        <mspr:IV_Size>8</mspr:IV_Size>
        <mspr:kid>+XBnYIdJBlinl7fNqMqemQ==</mspr:kid>
        <mspr:pro>xgIAAAEAAQC8AjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AKwBYAEIAbgBZAEkAZABKAEIAbABpAG4AbAA3AGYATgBxAE0AcQBlAG0AUQA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgAwAGsAaABJAFkAWABxADYAOQBSAEUAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBwAGwAYQB5AHIAZQBhAGQAeQAuAGUAbgB0AGkAdABsAGUAbQBlAG4AdAAuAG4AZQB4AHQALgB0AGgAZQBwAGwAYQB0AGYAbwByAG0ALgBjAG8AbQAvAHAAbABhAHkAcgBlAGEAZAB5AC8AcgBpAGcAaAB0AHMAbQBhAG4AYQBnAGUAcgAuAGEAcwBtAHgAPAAvAEwAQQBfAFUAUgBMAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA=</mspr:pro>
      </ContentProtection>
      <!-- Widevine -->
      <ContentProtection schemeIdUri="urn:uuid:EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED">
        <cenc:pssh>AAAAOHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABgiEFuTbJh1oxtChIE/W/ufKS5I49yVmwY=</cenc:pssh>
      </ContentProtection>
      <!-- Marlin -->
      <ContentProtection schemeIdUri="urn:uuid:5E629AF5-38DA-4063-8977-97FFBD9902D4">
        <mas:MarlinContentIds>
          <mas:MarlinContentId>urn:marlin:kid:606770f949875806a797b7cda8ca9e99</mas:MarlinContentId>
        </mas:MarlinContentIds>
      </ContentProtection>
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <Representation id="audio_eng=192000" bandwidth="192000">
        <BaseURL>1498350_0_3_97e86062ff144222bcaa787e30de0774_.mp4</BaseURL>
        <SegmentBase timescale="44100" indexRangeExact="true" indexRange="1579-48614">
          <Initialization range="0-1578" />
        </SegmentBase>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="2" group="1" contentType="audio" lang="pt" segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1" audioSamplingRate="44100" mimeType="audio/mp4" codecs="mp4a.40.2" startWithSAP="1">
      <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"></AudioChannelConfiguration>
      <!-- Common Encryption -->
      <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="606770F9-4987-5806-A797-B7CDA8CA9E99"></ContentProtection>
      <!-- PlayReady -->
      <ContentProtection schemeIdUri="urn:uuid:9A04F079-9840-4286-AB92-E65BE0885F95" value="MSPR 2.0">
        <cenc:pssh>AAAC5nBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAsbGAgAAAQABALwCPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgArAFgAQgBuAFkASQBkAEoAQgBsAGkAbgBsADcAZgBOAHEATQBxAGUAbQBRAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+ADAAawBoAEkAWQBYAHEANgA5AFIARQA9ADwALwBDAEgARQBDAEsAUwBVAE0APgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAHAAbABhAHkAcgBlAGEAZAB5AC4AZQBuAHQAaQB0AGwAZQBtAGUAbgB0AC4AbgBlAHgAdAAuAHQAaABlAHAAbABhAHQAZgBvAHIAbQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwByAGkAZwBoAHQAcwBtAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==</cenc:pssh>
        <mspr:IsEncrypted>1</mspr:IsEncrypted>
        <mspr:IV_Size>8</mspr:IV_Size>
        <mspr:kid>+XBnYIdJBlinl7fNqMqemQ==</mspr:kid>
        <mspr:pro>xgIAAAEAAQC8AjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AKwBYAEIAbgBZAEkAZABKAEIAbABpAG4AbAA3AGYATgBxAE0AcQBlAG0AUQA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgAwAGsAaABJAFkAWABxADYAOQBSAEUAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBwAGwAYQB5AHIAZQBhAGQAeQAuAGUAbgB0AGkAdABsAGUAbQBlAG4AdAAuAG4AZQB4AHQALgB0AGgAZQBwAGwAYQB0AGYAbwByAG0ALgBjAG8AbQAvAHAAbABhAHkAcgBlAGEAZAB5AC8AcgBpAGcAaAB0AHMAbQBhAG4AYQBnAGUAcgAuAGEAcwBtAHgAPAAvAEwAQQBfAFUAUgBMAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA=</mspr:pro>
      </ContentProtection>
      <!-- Widevine -->
      <ContentProtection schemeIdUri="urn:uuid:EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED">
        <cenc:pssh>AAAAOHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABgiEFuTbJh1oxtChIE/W/ufKS5I49yVmwY=</cenc:pssh>
      </ContentProtection>
      <!-- Marlin -->
      <ContentProtection schemeIdUri="urn:uuid:5E629AF5-38DA-4063-8977-97FFBD9902D4">
        <mas:MarlinContentIds>
          <mas:MarlinContentId>urn:marlin:kid:606770f949875806a797b7cda8ca9e99</mas:MarlinContentId>
        </mas:MarlinContentIds>
      </ContentProtection>
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <Representation id="audio_por=192000" bandwidth="192000">
        <BaseURL>1498350_0_2_afcc7cae0612498999f9a96fd2e51a62_.mp4</BaseURL>
        <SegmentBase timescale="44100" indexRangeExact="true" indexRange="1579-48614">
          <Initialization range="0-1578" />
        </SegmentBase>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="3" group="3" contentType="text" lang="pt-BR" mimeType="text/vtt" startWithSAP="1">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <Representation id="textstream_pt-BR=0" bandwidth="0">
        <BaseURL>1498350__782042_68f23f526b0442cb975fa0b9a140d472_.vtt</BaseURL>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="4" group="2" contentType="video" par="16:9" minBandwidth="267023" maxBandwidth="4719040" maxWidth="1920" maxHeight="1080" segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1" sar="1:1" frameRate="30000/1001" mimeType="video/mp4" startWithSAP="1">
      <!-- Common Encryption -->
      <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="606770F9-4987-5806-A797-B7CDA8CA9E99"></ContentProtection>
      <!-- PlayReady -->
      <ContentProtection schemeIdUri="urn:uuid:9A04F079-9840-4286-AB92-E65BE0885F95" value="MSPR 2.0">
        <cenc:pssh>AAAC5nBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAsbGAgAAAQABALwCPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgArAFgAQgBuAFkASQBkAEoAQgBsAGkAbgBsADcAZgBOAHEATQBxAGUAbQBRAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+ADAAawBoAEkAWQBYAHEANgA5AFIARQA9ADwALwBDAEgARQBDAEsAUwBVAE0APgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAHAAbABhAHkAcgBlAGEAZAB5AC4AZQBuAHQAaQB0AGwAZQBtAGUAbgB0AC4AbgBlAHgAdAAuAHQAaABlAHAAbABhAHQAZgBvAHIAbQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwByAGkAZwBoAHQAcwBtAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==</cenc:pssh>
        <mspr:IsEncrypted>1</mspr:IsEncrypted>
        <mspr:IV_Size>8</mspr:IV_Size>
        <mspr:kid>+XBnYIdJBlinl7fNqMqemQ==</mspr:kid>
        <mspr:pro>xgIAAAEAAQC8AjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AKwBYAEIAbgBZAEkAZABKAEIAbABpAG4AbAA3AGYATgBxAE0AcQBlAG0AUQA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgAwAGsAaABJAFkAWABxADYAOQBSAEUAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBwAGwAYQB5AHIAZQBhAGQAeQAuAGUAbgB0AGkAdABsAGUAbQBlAG4AdAAuAG4AZQB4AHQALgB0AGgAZQBwAGwAYQB0AGYAbwByAG0ALgBjAG8AbQAvAHAAbABhAHkAcgBlAGEAZAB5AC8AcgBpAGcAaAB0AHMAbQBhAG4AYQBnAGUAcgAuAGEAcwBtAHgAPAAvAEwAQQBfAFUAUgBMAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA=</mspr:pro>
      </ContentProtection>
      <!-- Widevine -->
      <ContentProtection schemeIdUri="urn:uuid:EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED">
        <cenc:pssh>AAAAOHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABgiEFuTbJh1oxtChIE/W/ufKS5I49yVmwY=</cenc:pssh>
      </ContentProtection>
      <!-- Marlin -->
      <ContentProtection schemeIdUri="urn:uuid:5E629AF5-38DA-4063-8977-97FFBD9902D4">
        <mas:MarlinContentIds>
          <mas:MarlinContentId>urn:marlin:kid:606770f949875806a797b7cda8ca9e99</mas:MarlinContentId>
        </mas:MarlinContentIds>
      </ContentProtection>
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <Representation id="video=267023" bandwidth="267023" width="480" height="270" codecs="avc1.42C01E" scanType="progressive">
        <BaseURL>1498350_3_1_4ced872310e940bd857c20b67c7dc3f0_.mp4</BaseURL>
        <SegmentBase timescale="30000" indexRangeExact="true" indexRange="1626-48613">
          <Initialization range="0-1625" />
        </SegmentBase>
      </Representation>
      <Representation id="video=464209" bandwidth="464209" width="640" height="360" codecs="avc1.42C01E" scanType="progressive">
        <BaseURL>1498350_4_1_5c3bccfeb4cd4831ac11aa8b87a850f9_.mp4</BaseURL>
        <SegmentBase timescale="30000" indexRangeExact="true" indexRange="1627-48614">
          <Initialization range="0-1626" />
        </SegmentBase>
      </Representation>
      <Representation id="video=931302" bandwidth="931302" width="960" height="540" codecs="avc1.4D401F" scanType="progressive">
        <BaseURL>1498350_0_1_5c4310139a9344cfa84b12f72ffb9e28_.mp4</BaseURL>
        <SegmentBase timescale="30000" indexRangeExact="true" indexRange="1628-48615">
          <Initialization range="0-1627" />
        </SegmentBase>
      </Representation>
      <Representation id="video=1451023" bandwidth="1451023" width="1280" height="720" codecs="avc1.4D401F" scanType="progressive">
        <BaseURL>1498350_2_1_dbe3b9f0a5984038a508ade48d3c8e7a_.mp4</BaseURL>
        <SegmentBase timescale="30000" indexRangeExact="true" indexRange="1628-48615">
          <Initialization range="0-1627" />
        </SegmentBase>
      </Representation>
      <Representation id="video=4719040" bandwidth="4719040" width="1920" height="1080" codecs="avc1.640028" scanType="progressive">
        <BaseURL>1498350_1_1_2960db4a856d4f21930d00e6d00d59e6_.mp4</BaseURL>
        <SegmentBase timescale="30000" indexRangeExact="true" indexRange="1631-48618">
          <Initialization range="0-1630" />
        </SegmentBase>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>
<!-- Created with Unified Streaming Platform(version=1.8.4) -->
TheModMaker commented 3 years ago

Can you post a link to the content? Just the manifest text isn't enough to debug. Does that error happen on desktop too? The manifest you posted above gives me a 403 error.

Also note that we don't support PNG subtitles with VTT, only TTML. I'm not sure how you would do it in VTT, so we can look at your content to see if this is something we can add.

pedrosilvabos commented 3 years ago

HI @TheModMaker I can, but it has limited time due to token (expires in a hour it shoud explain the 403 you got) Yes the error is in all platforms I have tested, Tizen, webos and desktop

And thank you for you help!

manifesturi:

https://ctsr525679amd-theplatform.akamaized.net/video/Telecine_-_Production/464/316/1498293_1553628169496.mpd?hdnts=st=1629828711~exp=1629829041~acl=/Telecine_-_Production/464/316/*~hmac=61ae227b3831b045682a8c159947b98cb2a532ae1c9e7a075de996e0e808b191

drmUrl: https://widevine.entitlement.theplatform.com/wv/web/ModularDrm/getRawWidevineLicense?schema=1.0&account=http%3A%2F%2Faccess.auth.theplatform.com%2Fdata%2FAccount%2F2699983779&token=eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJNSXRjdF9LRmxwWVExSDVPL3Vybjp0b29sYm94OjU3MDAwM2M1OWU1NzgxMmQ3YmIwYTQ2ZiIsImlzcyI6IjEiLCJleHAiOjE2Mjk5MTQ1NTMsImlhdCI6MTYyOTgyODE1MzIwMSwianRpIjoiYjlhNzY0MGYtZmY1Mi00YjM4LTljY2QtMWI0MDI1OWYzNjM1IiwiZGlkIjoiTUl0Y3RfS0ZscFlRMUg1TyIsInVubSI6InVybiUzQXRvb2xib3glM0E1NzAwMDNjNTllNTc4MTJkN2JiMGE0NmYiLCJjdHgiOiJ7XCJ1c2VyTmFtZVwiOlwidXJuOnRvb2xib3g6NTcwMDAzYzU5ZTU3ODEyZDdiYjBhNDZmXCIsXCJhdHRyaWJ1dGVzXCI6e1wiZW1haWxcIjpcImpvcmlnb3NpQGdtYWlsLmNvbVwiLFwiZGlzcGxheU5hbWVcIjpcIkpPQU8gUklDQVJETyBHT05DQUxWRVMgREEgU0lMVkFcIixcImF2YWlsYWJpbGl0eVR5cGVcIjpcIm9wZXJhZG9yYS1wYXl0dlwifX1cbiIsIm9pZCI6bnVsbH0.bl2NL88jLWw_IcR9ptsuMAPKVarC0ZnS81b1FlNBHO4icHmtYjFlL8sXF7F5rZf3o6gMBlcE2hXSKb9EGXkZNmiyd4J_plFrsppZhxHzknTR3ZTQwvz2gVk188dBFf-kzVuu2VTTVOJhA8xRaFgxyKY_RFVr68NJR6kjqBUVeTUBPjC1EVmtyTNSV9-pO6HQyuH0w5RvCciRdAu_5NnWVNHU7DqXtbkRc-3qrewMJqaS11g_2-JWNSgGXFuZ90jDdTo8wBIrEbic1R9hPGVsLVUtJbpUYuR8o_rTo3gDk3OxyyEIwSGOb5t4kHzuq4m2w_5F72Tg1jlPDNGgEJikkw&releasePid=cKAy0CaskdxO&token=null

TheModMaker commented 3 years ago

It looks like your VTT content has invalid tags. It looks like Foo <i>Bar</i></i>. We could make our parser more resilient for that kind of content.

pedrosilvabos commented 3 years ago

@TheModMaker Thank you for you help, I will pass that info to my Team Leader so he can pass it on to someone. On the meanwhile, is there anything I can do? Thank you again!

pedrosilvabos commented 3 years ago

@TheModMaker Hi again, would it be possible to manipulate the vtt file in the manifest to correct the errors and then pass it up to the player ? (I can see it here under the [[scope]] but I am unable to access it) image

these are the ones causing problems: image

and then I would run a function to correct or eliminate tags that do not belong and then feed subtitles back to the player. is this possible ?

TheModMaker commented 3 years ago

You could write a response filter. You can see the license wrapping tutorial for some basic info. You can basically just replace the data before we see it:

player.getNetworkingEngine().registerResponseFilter(function(type, response) {
  const StringUtils = shaka.util.StringUtils;
  if (type == shaka.net.NetworkingEngine.RequestType.MEDIA && response.uri.endsWith('.vtt')) {
    const str = StringUtils.fromUTF8(response.data);

    // Update "str"

    response.data = StringUtils.toUTF8(str);
  }
});
pedrosilvabos commented 3 years ago

@TheModMaker I owe you a beer!!!!!! This is so awesome! I can now fix these broken subtitles!!! Thank you I had to change the code a little bit like:

 this.shakaPlayer.getNetworkingEngine().registerResponseFilter(function(type, response) {
                    const StringUtils = globalThis['shaka']['util']['StringUtils']
                    if(response.uri.endsWith('.vtt'))
                    {
                        let str = StringUtils.fromUTF8(response.data);
                        let re = new RegExp("</i></i>", 'g');
                        str = str.replace(re,"</i>");
                        response.data = StringUtils.toUTF8(str);
                    }

                });

I would also need help on mp4/application subtitles, that are on other manifest. @joeyparrish has told me to do something like:

player = new shaka.Player(video);
player.setVideoContainer(videoContainer);
// Force the player to re-evaluate what the default configs should be,
// so that you get the UI-based text display:
player.resetConfiguration();
// Now do whatever configuration you normally would

I can see this does create a div for the subtitles but nothing is passed in. image

I have implemented the code this way: image image

The result here is that i have no subtitles.

I have tried this on the shaka demo and noticed I have the same result if I turn off the shaka-controls is there a workaround I could use here ?

I'll be more then happy to provide manifestUri and DrmUrl on demand for testing. These are live channels with Portuguese/Brazilian subtitles

Let me know if you think this would make more sense in another issue. Thank you!!

shaka-bot commented 9 months ago

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.