youtube-ios-player-helper icon indicating copy to clipboard operation
youtube-ios-player-helper copied to clipboard

No subtitles shown in fullscreen mode.

Open marcelderkskarlmax opened this issue 3 years ago • 8 comments

Hello!

We are using youtube content with subtitles. When playing the videos in embedded mode, these subtitles are correctly displayed. But when switching into fullscreen mode these subtitles are suddenly disappearing and also there is no settings menu visible anymore to toggle them back on.

This is very annoying as users who switch to fullscreen are especially interested in the content but are not able to consume anymore :-/

Tested with iOS 15.2.1 youtube-ios-player-helper (1.0.4)

Player parameters:

[ "controls": 1, "modestbranding": 1, "playsinline": 1, "rel": 0, "showinfo": 0 ]

Thank you! Any help appreciated.

marcelderkskarlmax avatar Jan 25 '22 17:01 marcelderkskarlmax

Hi @marcelderkskarlmax ,

Can you provide us with the video ids you are having trouble with?

Thank you, we will take a look into it.

brol1dev avatar Jan 26 '22 18:01 brol1dev

Sure!

For example we are showing this content:

https://www.youtube.com/watch?v=eEqMwv362kM

marcelderkskarlmax avatar Jan 27 '22 17:01 marcelderkskarlmax

I'm seeing the same thing. Also seems to happen when using airplay to stream to another device. I'm guessing it's a related cause.

Same versions/config

amill676 avatar Feb 07 '22 08:02 amill676

Hello @marcelderkskarlmax, I've tried reproducing your issue within our demo application with the same player settings/video id and have been unable to reproduce this issue.

Are you able to reproduce the issue within our demo application. If not, can you provide more detailed instructions on how this is occuring?

jasonszheng avatar Feb 07 '22 20:02 jasonszheng

@jasonszheng

Thats interesting. I will try that myself and provide feedback here. Thanks !

marcelderkskarlmax avatar Feb 08 '22 07:02 marcelderkskarlmax

@jasonszheng

I took your example project and played the video id in your SingleVideoViewController and indeed the subtitles work there. So I tried to isolate the problem more.

I added a new ViewController to your example project called SwiftVideoController . There I added the following code which is the way we are using the youtube helper in our project.

import Foundation
import UIKit
import youtube_ios_player_helper

class SwiftVideoPlayer: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let youtubePlayerView = YTPlayerView()
        
        let playerVars: [String: Any] = [
            "controls": 1,
            "modestbranding": 1,
            "playsinline": 1,
            "rel": 0,
            "showinfo": 1
        ]
        
        view.addSubview(youtubePlayerView)
        youtubePlayerView.translatesAutoresizingMaskIntoConstraints = false
        
        NSLayoutConstraint.activate([
            youtubePlayerView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0),
            youtubePlayerView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0),
            youtubePlayerView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
            youtubePlayerView.heightAnchor.constraint(equalTo: view.widthAnchor, multiplier: 9/16)
        ])

        youtubePlayerView.load(withVideoId: "eEqMwv362kM", playerVars: playerVars)
    }
}

I added this controller as third tab on the tab controller in the example app. With this code I can reproduce the issue again.

Is there something wrong in the way I use the youtube player view here ?

marcelderkskarlmax avatar Feb 09 '22 13:02 marcelderkskarlmax

@marcelderkskarlmax @rcvrgs @jasonszheng I see this issue too, and think I partially narrowed it down -- the player maintains subtitles when going to fullscreen if the embedded player is not full width:

youtubePlayerView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 10),
youtubePlayerView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -10),
Embedded full-width to fullscreen has no subs Embedded partial-width to full screen has subs

I could conjecture that if the width doesn't change, the player doesn't know that it needs to re-apply the subtitles (?).

shusta-patreon avatar Jun 21 '22 22:06 shusta-patreon

Wow ! Thank you so much !

I would never have had the idea to try that out. Maybe I can constraint the video one pixel at each side to the negative screen space. So that there would be still no visible gap.

marcelderkskarlmax avatar Jun 22 '22 08:06 marcelderkskarlmax