question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Text-Tracks not parsed on iOS

See original GitHub issue

Bug

Subtitles listed in textTracks are null when utilizing version 6.0.0-alpha.1. This issue does not exist on the latest stable release 5.2.0.

Platform

Tested on iPhone 12 Simulator

Environment info

Library version: 6.0.0-alpha.1

Steps To Reproduce

Fetch the available textTracks from data provided via the onLoad-Event.

Screenshot 2022-08-09 at 16 07 22

Video sample

https://bitmovin-a.akamaihd.net/content/sintel/hls/playlist.m3u8

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jemise111commented, Oct 14, 2022

We’re facing this issue too (on 6.0.0-alpha3) but I believe the cause is different.

We’re passing a .m3u8 source with a selectedTextTrack. It looks like setSelectedTextTrack is called immediately because the prop is set. This calls RCTPlayerOperations.setMediaSelectionTrackForCharacteristic which relies on _player to not be nil… but during the initial render it is nil since it is not instantiated until this line (which intentionally has a built in delay and some setup code first).

And so it is crashing on this line because group is nil.

This ^ crash also lines up with the stack trace provided by @awinograd.

We were able to fix this by simply adding a guard against group being nil.

static func setMediaSelectionTrackForCharacteristic(player:AVPlayer?, characteristic:AVMediaCharacteristic, criteria:SelectedTrackCriteria?) {
    let type = criteria?.type
    let group:AVMediaSelectionGroup! = player?.currentItem?.asset.mediaSelectionGroup(forMediaCharacteristic: characteristic)
    var mediaOption:AVMediaSelectionOption!

    guard group != nil else { return }  // <======= HERE

    if (type == "disabled") {
        // Do nothing. We want to ensure option is nil
    } else if (type == "language") || (type == "title") {
    ....
    ....
    ....

And I believe this fix might be a good one since setSelectedTextTrack is called again immediately after _player is instantiated (via applyModifiers). If anyone has more insight and agrees I’m happy to put up a PR

1reaction
alexejhcommented, Sep 9, 2022

The main issue is that we pass a custom class array in a react native event. I had not time yet to make a PR, but could successfully test it with this line change.

image
Read more comments on GitHub >

github_iconTop Results From Across the Web

videojs player.textTracks() returns wrong type of object on ...
I am trying to work with some TextTrack information connected to a video. I've got a video embedded from Mux.com, which has metadata ......
Read more >
HTMLMediaElement.textTracks - Web APIs | MDN
A TextTrackList object representing the list of text tracks included in the media element. The list of tracks can be accessed using textTracks[n] ......
Read more >
Videojs Text Tracks
Subtitles: Translations of the dialogue in the video for when audio is available but not understood. · Captions: Transcription of the dialogue, sound...
Read more >
WebVTT - Web Video Text Tracks | Can I use... Support tables ...
WebVTT - Web Video Text Tracks. - CR. Format for marking up text captions for ... Safari on iOS *. 3.2 - 6.1...
Read more >
Adding Text Tracks to a Video
If no label is supplied, the language code is displayed. Select the Kind of text track. Options include: Captions - Similar to subtitles,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found