-1

How to disable menu button press in TVML? For some scenarions in my project,like while playing Ads in video, I dont want user to skip it by pressing menu button.I did not see any solution on internet. Please help.

function loadingDoc() {                                     
var Template =  `
 <document>
    <divTemplate>
        <title style="tv-position: bottom-right;">1/1</title>
    </divTemplate>
</document>`

var templateParser = new DOMParser();
parsedTemplate = templateParser.parseFromString(Template, "application/xml");
parsedTemplate.addEventListener("disappear", highlightThumbnail.bind(this));
player.interactiveOverlayDocument = parsedTemplate;
player.interactiveOverlayDismissable = true;

}

var highlightThumbnail = function (event){
    loadingDoc();
}
  • provide your code to look and suggest – eduPeeth Jul 20 '18 at 07:00
  • Its something like you are playing any video but you don't want user to dismiss the player by pressing menu button. I am using native tvml player. – Nivedita Sinha Jul 20 '18 at 07:04
  • I think what Sinha is asking is: How to attach the UITapGestureRecognizer to the native TVML video player https://developer.apple.com/documentation/tvmljs/player – kaho Jul 24 '18 at 17:29

1 Answers1

0

Two solutions that might work are:

1) Native + TVML: find the topmost view controller as mentioned in iPhone -- How to find topmost view controller and apply UITapGestureRecognizer to it.

2) TVML only: with interactiveOverlayDismissable and interactiveOverlayDocument, you can push another overlay document when the user dismisses the current one. Thus-- they will never be able to menu out.

kaho
  • 4,650
  • 1
  • 13
  • 24
  • Thanks, Kaho for the reply. But the solution did not seems to work. I tried: myPlayer.interactiveOverlayDocument = parsedDoc; myPlayer.interactiveOverlayDismissable = false; – Nivedita Sinha Jul 25 '18 at 09:19
  • hey sorry for not being super clear, I mean, you can set myPlayer.interactiveOverlayDismissable to true, then on the parsedDoc, add the dismiss event listener to the overlay document, (which get fired on user hit menu), in that callback, you can set the myPlayer.interactiveOverlayDocument to the same document again – kaho Jul 25 '18 at 18:03