PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label tvos. Show all posts
Showing posts with label tvos. Show all posts

Thursday, September 29, 2022

[FIXED] How to prevent game controller button B from quitting app / navigating back to menu in tvOS

 September 29, 2022     gamecontroller, tvos     No comments   

Issue

The game controller button B is, by default, quitting the app and navigating back to the tvOS home screen. At first I thought this was intuitive, but quickly realized that's what the Nimbus MENU button (dead middle of the controller) is for, and that I actually want to use button B in-game.

Setting a change handler for button B works, but the app still quits when the button is released.

GCControllerButtonValueChangedHandler buttonBHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) {
        NSLog(@"B");
};

Solution

I had the same issue.

The solution was to have my main ViewController inherit from GCEventViewController instead of UIViewController.

By default, when using GCEventViewController, the MENU button will not return to the menu. In this case, if you want it to be able to return to the menu with the original behavior you can simply set controllerUserInteractionEnabled to YES.

see the documentation for this class here : https://developer.apple.com/library/tvos/documentation/GameController/Reference/GCEventViewController_Ref/index.html

edit : apple dev forum helpep me fix this issue : https://forums.developer.apple.com/message/57926#57926

hope this helps,



Answered By - François Pilote
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to handle tvOS MenuBarTemplate selection?

 September 29, 2022     tvjs, tvml, tvos     No comments   

Issue

I have a basic MenuBarTemplate set up and displaying.

How do I react to a user's Menu selection and load an appropriate content template?


Solution

In the menuItem tag include a template attribute pointing to the template to load and a presentation attribute set to menuBarItemPresenter.

<menuItem template="${this.BASEURL}templates/Explore.xml.js" 
  presentation="menuBarItemPresenter">
    <title>Explore</title>
</menuItem>

You can then use the menu bar's MenuBarDocument feature to associate a document to each menu bar item.

menuBarItemPresenter: function(xml, ele) {
  var feature = ele.parentNode.getFeature("MenuBarDocument");
  if (feature) {
    var currentDoc = feature.getDocument(ele);
    if (!currentDoc) {
      feature.setDocument(xml, ele);
    }
  }

This assumes you're using a Presenter.js file like the one in Apple's "TVML Catalog" sample. The load function specified there is what calls the function specified in the menuItem's presentation attribute.



Answered By - Jeff Bowen
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to add a placeholder image in img tag in TVML?

 September 29, 2022     apple-tv, tvjs, tvml, tvos     No comments   

Issue

Hi I am new a t TVML just want to know how can you load an image in a URL and to have a placeholder image while waiting for the URL.

I'm using the img tag.

Let me know thanks.


Solution

It seems presently this feature is not supported on the TVML side.

You can always file a bug with Apple for this feature in future release.



Answered By - Aditya Jhunjhunwala
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to display GameCenter leaderboard sets on tvOS?

 September 29, 2022     tvos     No comments   

Issue

I have been trying to add multiple leaderboards that are in leaderboard sets to my tvOS target of my iOS game. I already have a game on the tvOS App Store so I know I have to add the leaderboards in the asset catalogue, as described here How to display GameCenter leaderboard on tvOS?

Now when trying to add multiple leaderboards I assumed you would add each leaderboard set with the corresponding image in Xcode (with correct leaderboard set ID), however this doesn't really work.

I can open the game enter menu on my TV and see the leaderboard sets, they even say how many leaderboards they contain, however clicking on it just says no data.

I tried signing out and back into game enter because you sometimes get the "no data" message on iOS in sandbox mode and a sign out/in fixes it. That didn't work.

Surely I don't have to add 40 leaderboards to my asset catalogue, that seems ridiculous

Has anyone done this before, I don't know what I am missing

Thanks


Solution

It seems you have to actually add each leaderboard set in Xcode asset catalogue with corresponding ID in the inspector on the right. Than for each leaderboard in a set you have to add the leaderboard. This seems madness if you have a lot of leaderboards but I haven't figured out another way yet.



Answered By - crashoverride777
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to handle tvOS fonts SpriteKit

 September 29, 2022     fonts, sprite-kit, swift, tvos     No comments   

Issue

How do you guys handle converting your iOS games to tvOS in regards to fonts?

tvOS hardly supports any fonts available on iOS and therefore my game menus etc just look plain and boring on the appleTV.

I understand that Apple wants to use SanFrancisco style fonts for apps for legibility, which makes sense. For Spritekit games however those fonts dont look good at all, especially when having cartoonish style artdesign.

Is there any trick to get fonts such as Chalkduster, Damascus etc to work on tvOS in code without having to resort do do all the menus in Photoshop just for the appleTV.

Am I missing something?


Solution

As Daniel Storm so kindly pointed out to use custom fonts beyond the supported ones I can follow this stack overflow question

How to add custom fonts to an iPhone app?



Answered By - crashoverride777
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to show a Vimeo video in an Apple TV app

 September 29, 2022     apple-tv, tvos, vimeo     No comments   

Issue

I'm trying to show a Vimeo video with a sample app for Apple TM.

This is my code:

var Template = function() { return `<?xml version="1.0" encoding="UTF-8" ?>
<document>
<catalogTemplate>
    <banner>
        <title>RWDevConHighlights</title>
    </banner>
    //add stuff here
    //1.
    <list>
        <section>
            //2.
            <listItemLockup>
                <title>Inspiration Videos</title>
                <decorationLabel>4</decorationLabel>
                <relatedContent>
                    <grid>
                        <section>
                            //2
                            <lockup videoURL="http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4">
                                <img src="${this.BASEURL}images/ray.png" width="500" height="308" />
                            </lockup>
                        </section>
                    </grid>
                </relatedContent>
            </listItemLockup>
        </section>
    </list>
</catalogTemplate>
</document>`
};

This doesn't work:

<lockup videoURL="https://vimeo.com/176253524">
                            <img src="${this.BASEURL}images/ray.png" width="500" height="308" />
                        </lockup>

How can I integrate a Vimeo video?


Solution

At the vimeo.com you can press button "Share" and get a correct link to your video. So, I think you should use https://player.vimeo.com/video/176253524 instead of your url.



Answered By - Roman Podymov
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to focus a UICollectionViewCell in UITableViewCell in tvOS?

 September 29, 2022     swift, tvos, uicollectionview, uicollectionviewcell, uitableview     No comments   

Issue

Description:

I have a list of UITableViewCells that have each have a UICollectionView with X amount of UICollectionViewCells (see image below for more clarity)

The idea behind this is to be able to implement sections with a header on top and a horizontal scrolling UICollectionView

Everything is working great, except when I try to focus the UICollectionViewCells (aka: CategoryCell). The UITableViewCell gets focused and highlights all the content making it impossible to focus any of the UICollectionViewCells.

What I've tried:

According to other posts the fix for this would be deactivate User Interaction and/or set the selection style to none on the UITableViewCell:

cell.selectionStyle = UITableViewCellSelectionStyle.None

and to enable User Interaction on the UICollectionViewCell instead.

Here are posts that talk about it:

UITableViewCell with UITextField losing the ability to select UITableView row?

How can I disable the UITableView selection highlighting?

I've attempted to implemen these solutions without success.

Question:

What step did I miss? Does the fix not work on tvOS? How do I focus my UICollectionViewCell that is in a UICollectionView that is in a UITableViewCell?

More:

Table View Controller

Image showing my UITableViewController and all it's contents from my StoryBoard.


Solution

The problem is most likely that your table view cells are returning true to canBecomeFocused. You can disable that by either implementing the UITableViewDelegate method tableView(_, canFocusRowAt:) to return false, or by subclassing UITableViewCell and returning false from canBecomeFocused.

The focus engine will try to focus on the top-most view that returns true from canBecomeFocused, which is why it can't find your collection view cells: they're "hidden" inside the focusable table view cells. If you disable focus on the table view cells, then the focus engine will be able to find your collection view cells.

override func tableView(tableView: UITableView, canFocusRowAtIndexPath indexPath: NSIndexPath) -> Bool {
    return false
}


Answered By - Justin Voss
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to set the identifier of AVMetadataItem in swift3?

 September 29, 2022     avmetadataitem, swift, swift3, tvos     No comments   

Issue

Description:

I'm attempting to set the identifier of AVMetadataItem in swift3, like mentioned in this apple video. However, the video is pre-swift3.

In swift2 it would look something like this:

let metadataItem = AVMetadataItem(identifier: AVMetadataCommonIdentifierTitle, value: "Title here")

However, in swift3 that constructor does not exist anymore.

There is an empty constructor and this one:

AVMetadataItem(propertiesOf: AVMetadataItem, valueLoadingHandler: (AVMetadataItemValueRequest) -> Void)

There does not seem to be any methods that exist to set the identifier.

Question:

How do I set the identifier of AVMetadataItem in swift3?

Edit:

Tried with AVMutableMetadataItem() as suggested by Lucas.

private func setupNavigationMarker(title: String, description: String, timeRange: CMTimeRange)-> AVTimedMetadataGroup {
    var items: [AVMetadataItem] = []
    let titleItem =  AVMutableMetadataItem()
    titleItem.identifier = AVMetadataCommonIdentifierTitle
    titleItem.value = title as (NSCopying & NSObjectProtocol)?
    items.append(titleItem)

    let descriptionItem = AVMutableMetadataItem()
    descriptionItem.identifier = AVMetadataCommonIdentifierDescription
    descriptionItem.value = description as (NSCopying & NSObjectProtocol)?
    items.append(descriptionItem)

    return AVTimedMetadataGroup(items: items, timeRange: timeRange)

}

and here in use:

    let cmTimeStart = CMTimeMake(0, 0)
    let cmTimeDuration = CMTimeMake(10, 1)

    let timeRange = CMTimeRange(start: cmTimeStart, duration: cmTimeDuration)

    let timedMetadataGroup = self.setupNavigationMarker(title: "test", description: "description test" , timeRange: timeRange)
    let timedMetadataGroupList = [timedMetadataGroup]
    let navigationMarkersGroup = AVNavigationMarkersGroup(title: "Chapters", timedNavigationMarkers: timedMetadataGroupList)
    //predefined avPlayerItem
    avPlayerItem.navigationMarkerGroups.append(navigationMarkersGroup)

It compiles and runs but no navigation markers (aka chapters) are proposed when the video plays. What am I missing?


Solution

Use AVMutableMetadata instead of AVMetadata this way you can modify the identifier as you choose to.

let titleItem =  AVMutableMetadataItem()
titleItem.identifier = AVMetadataCommonIdentifierTitle


Answered By - Luca Davanzo
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I get a specific button running on tvOS (AppleTV) to take focus? (Objective C)

 September 29, 2022     focus, objective-c, tvos     No comments   

Issue

The project have some views with different buttons. When I hide a view and show the other view, I can't get the focus on my button.

I think is related to setNeedsFocusUpdate. I have read the Apple doc. There is not any example.

Does anyone know how to do it and put an example (Objective C)?


Solution

You need to override preferredFocusedView, and when you are hiding one view and showing there call this method setNeedsFocusUpdate, your preferredFocusedView implementation should be something like this

- (UIView *)preferredFocusedView
{
    // Add your logic here, it could be more complicated then what is below
    if (view1.hidden)
    {
        return _button;
    }
    else 
    {
        return _button2
    }
}

And if you want to make custom view get focus, override canBecomeFocused method and return true

Edit

You can use add a breakpoint and execute this command po [buttonYouWantToFocus _whyIsThisViewNotFocusable] it will tell you why its not focusable.



Answered By - Adnan Aftab
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to add a clear button to the keyboard on tvos?

 September 29, 2022     keyboard, tvos, uitextfield     No comments   

Issue

I have been looking for a way to add a clear button on tvos. I tried adding a button to self.rightView of the UITextField.

But it does not work. Is there another solution for this?


Solution

I know this doesn't answer your exact question about how to add a button to a text field, but as a user you can clear any text field by clicking and holding the backspace button.



Answered By - Justin Voss
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to add Navigation Markers as Chapters for my video in tvOS?

 September 29, 2022     swift, swift3, tvos     No comments   

Issue

Description:

I'm trying to understand (the madness) on how to add navigation markers to my video in tvOS.

Logically it shouldn't be complicated. Specify a list of markers with a chapter starting point, a chapter title, and a thumbnail for that specific video point.

However, I'm having a hard time grasping how to implement this.

What I've tried:

This is what I believe is the minimum for this to be implemented, however I have no idea why I need all this for it to work. I also have no idea how I'm supposed to set the information.

    //In my AVPlayerViewController
    let metadataItem = AVMetadataItem()

    let metadataItemList = [metadataItem]

    let cmTimeStart = CMTimeMake(0, 0)
    let cmTimeDuration = CMTimeMake(10, 1)

    let timeRange = CMTimeRange(start: cmTimeStart, duration: cmTimeDuration)

    let timedMetadataGroup = AVTimedMetadataGroup(items: metadataItemList, timeRange: timeRange)
    let timedMetadataGroupList = [timedMetadataGroup]
    let navigationMarkersGroup = AVNavigationMarkersGroup(title: "Chapters", timedNavigationMarkers: timedMetadataGroupList)

    //Already previously initialized avPlayerItem
    avPlayerItem.navigationMarkerGroups.append(navigationMarkersGroup)

(The goal with the code above is to have one chapter shown for my video.)

Question:

I'm seeking clarity on how to implement the Navigation Markers as "Chapters" in my video in tvOS. A detailed explanation on what each part is supposed to accomplish would equally be very helpful.


Solution

Introduction

To be able to add chapters the concept isn't as complicated as I had originally thought. You'll need to use the following main classes:

  • AVMetadataItem
  • AVMutableMetadataItem
  • AVTimedMetadataGroup
  • AVNavigationMarkersGroup

Part 1: Creating a chapter generating method

To simplify the work, we'll create a method that generates a "chapter" or as you'll see a AVTimedMetadataGroup that consists of a title, a description, and a start time.

The main issue I had was that in Swift2 we could specify the identifier type directly with AVMetadataItem (EDIT: This is factually wrong, in their examples they created a custom class called AVMettadataItem that used AVMutableMetadataItem to generate what they wanted) which isn't possible anymore with Swift3. However, this can be solved with AVMutableMetadataItem

For example this is how we create a AVMutableMetadataItem for the title of the chapter:

let titleItem =  AVMutableMetadataItem()
titleItem.identifier = AVMetadataCommonIdentifierTitle
titleItem.value = title as (NSCopying & NSObjectProtocol)?

Each of these items needs to be added to a list that we'll call "items" ( [AVMetadataItem] )

Once your list is completed, you'll want to create the AVTimedMetadataGroup with the list you just created and the timeRange that will be applied to your video (aka: Where you chapter will start and how long it lasts)

In my case, chapter duration isn't a big deal so I set it to a fixed time (10 seconds).

The thing that you need to watch out for is, if the CMTime is not valid, the chapter does not show up in the list.

private func setupNavigationMarker(title: String, description: String, timeStart: Int64)-> AVTimedMetadataGroup {

    let timeRange = CMTimeRange(start: CMTimeMake(timeStart, 1), duration: CMTimeMake(10, 1))

    var items: [AVMetadataItem] = []
    let titleItem =  AVMutableMetadataItem()
    titleItem.identifier = AVMetadataCommonIdentifierTitle
    titleItem.value = title as (NSCopying & NSObjectProtocol)?
    items.append(titleItem)

    let descriptionItem = AVMutableMetadataItem()
    descriptionItem.identifier = AVMetadataCommonIdentifierDescription
    descriptionItem.value = description as (NSCopying & NSObjectProtocol)?
    items.append(descriptionItem)

    return AVTimedMetadataGroup(items: items, timeRange: timeRange)

}

Part 2: Add your chapter to your AVNavigationMarkerGroup

Then somewhere in your AVPlayerViewController (like ViewDidLoad):

var timedMetadataGroupList = [AVTimedMetadataGroup]()

timedMetadataGroupList.append(self.setupNavigationMarker(title: "test1", description: "description test1" , timeStart: 100))
timedMetadataGroupList.append(self.setupNavigationMarker(title: "test2", description: "description test2" , timeStart: 200))
timedMetadataGroupList.append(self.setupNavigationMarker(title: "test3", description: "description test3" , timeStart: 300))

let navigationMarkersGroup = AVNavigationMarkersGroup(title: "Chapters", timedNavigationMarkers: timedMetadataGroupList)

avPlayerItem.navigationMarkerGroups.append(navigationMarkersGroup)

Part 3: Add images to your chapters

Coming soon...

https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/MediaPlaybackGuide/Contents/Resources/en.lproj/UsingAVKitPlatformFeatures/UsingAVKitPlatformFeatures.html



Answered By - kemicofa ghost
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to detect click-press on the touchpad on Apple TV's remote?

 September 29, 2022     siri-remote, swift, tvos     No comments   

Issue

How can I detect a "click press", not just a tap, on the touchpad on siri remote?

EDIT: My main problem was that my view had an UIButton that received the event.


Solution

By reading the UIPressesEvent's. Detecting Gestures and Button Presses

override func pressesEnded(presses: Set<UIPress>, withEvent event: UIPressesEvent?) {
    for press in presses {
        if (press.type == .Select) {
           // Select is pressed
        }  else {
            super.pressesEnded(presses, withEvent: event)
        }
    }
}


Answered By - Jeroen Bakker
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can I get rid of "Update to recommended settings" warning?

 September 29, 2022     ios, tvos, xcode     No comments   

Issue

I'm porting an iOS game to tvOS (Unity game). I have this annoying warning that I can't get rid of. Whenever I click on "Update to recommended settings" it pops up a window saying "Project settings are valid". The warning's still there.

enter image description here

(Never mind the other warnings :D)

Things I've tried: Clean>Rebuild the project, restart xCode

Any ideas?


Solution

I found that closing the project, quitting Xcode, restarting Xcode and re-opening the project worked for me. Xcode 8.1 (8B62)



Answered By - Jim T
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] how to use preferredFocusEnvironments insted of preferredFocusedView for ios 10?

 September 29, 2022     apple-tv, tvos, tvos10, tvos9.1     No comments   

Issue

I am working on apple tv os application. I want to move focus on particular UiButton but I don't know how to use preferredFocusEnvironments instead of preferredFocusedView ?

I am able to use preferredFocusedView but for this variable is deprecated.

so anyone can help me for this issue?


Solution

I am able to solve this question by following this link

What i did is as below :

@IBOutlet weak var viewTemp: UIView!
override var preferredFocusEnvironments : [UIFocusEnvironment] {
    //Condition
    return [viewTemp]
}

insted of this.

override weak var preferredFocusedView: UIView? {
    //Condition
    return viewTemp
}


Answered By - vikas prajapati
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to move focus at navigationbar's BarButtonItem in apple tv?

 September 29, 2022     apple-tv, tvos, tvos10, tvos9.1     No comments   

Issue

I am working on apple tv application.I want to move focus on navigation bar's BarButtonItem.

actually when view controller hasn't any button or text field then focus moved on BarButtonItem but when I added button in view controller then focus not able to move at BarButtonItem.

can anyone help me to solve this issue?


Solution

Now I am able to move focus at BarButtonItem in navigation control. I think the best way to making tv app design is put view or button by vertical and horizontal axis appropriate.

You have to put button or view by horizontal and vertical axis wise. otherwise, for moving focus from one button to another, you have to add UIfocasGuide in your view.

At the time when I ask the question I had not the put button with appropriate axis wise so I was not able to move focus BarButtonItem but after done those way I am able to move focus at BarButtonItem in a navigation controller.



Answered By - vikas prajapati
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How do you display closed caption format of HLS video stream from an m3u8 URL

 September 29, 2022     closed-captions, ffmpeg, tvos, video, video-streaming     No comments   

Issue

I'm working on a Roku and TVOS app that is going to play HLS videos (VOD and live) as well as MP4. According to the Roku docs EIA-608 is supported on both and should also work on TVOS.

My question is, given URL to the m3u8 how can I tell what specific format (EIA-608,WebVTT etc) of closed captioning is being used in each stream?

Contents of the main m3u8 (note 1st stream says no CC, but it really does have it):

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=380000,RESOLUTION=400x228,CODECS="avc1.66.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/index_0_av.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=750000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2",CLOSED-CAPTIONS=NONE
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/index_1_av.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1044000,RESOLUTION=1280x720,CODECS="avc1.64001f, mp4a.40.2",CLOSED-CAPTIONS=NONE
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/index_2_av.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2127000,RESOLUTION=1280x720,CODECS="avc1.64001f, mp4a.40.2",CLOSED-CAPTIONS=NONE
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/index_3_av.m3u8

Contents of the 1st stream's m3u8

#EXTM3U
#EXT-X-TARGETDURATION:4
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:4.000,
http://d.com/i/video/2426832/2426832_,350,640,1000,2000,.mp4.csmil/segment1_0_av.ts
...

I can use ffprobe -hide_banner to show the 1st program's stream has closed captioning. Ex:

Duration: 00:02:36.76, start: 0.100511, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 380000
    Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 400x228 [SAR 1:1 DAR 100:57], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 380000
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp, 48 kb/s
    Metadata:
      variant_bitrate : 380000

However, as you can see, Program 0 > Stream 0 just says that is has Closed captions - it does not list the type/spec of closed captioning technology being used.

How do I display the format of the Closed Captions?


Solution

WebVTT is what is know as a 'side car', or 'out of band' format. Meaning captions are in a separate file that you must download. You can see the URL for this file in the m3u8. Here the caption are part of the video stream itself. The only supported format in this case is EIA-608. ffmpeg support for 608 is pretty limited. The best tool I know of to for dealing with 608 is libcaption (full disclosure, I wrote it). I recently added a ts2srt example program. Fair warning its still sorta betaish.



Answered By - szatmary
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] When is the memory allocated for UICollectionViewCell rasterizations freed?

 September 29, 2022     ios, swift, tvos, uicollectionview, uicollectionviewcell     No comments   

Issue

So, in my app I have a bunch of view controllers that use UICollectionView as their main structure. These contain cells composed of an image and some overlay text and there are a potentially large number of these cells that will be created throughout the course of navigating the app (well into the hundreds and possibly 1000+. It's a huge catalog of content). I've found the enabling rasterization:

cell.layer.shouldRasterize = true
cell.layer.rasterizationScale = UIScreen.mainScreen().scale

drastically speeds up performance, making the framerate go from ~31fps to ~58fps, but, as expected, the memory for the app steadily increases.

So my question is when are these cached rasterized images removed? Is it only when the app is stopped? Or is it when the views containing them are deinit? Is there a way to manually force them to be removed if it's the former?


Solution

enter image description hereThe cached layers are removed if unused for 100ms.

Here are important notes from WWDC 2014

  • The image is composited on the GPU
  • Cache size is limited to 2.5x of screen size

http://devstreaming.apple.com/videos/wwdc/2014/419xxli6f60a6bs/419/419_advanced_graphics_and_animation_performance.pdf



Answered By - Mark McCorkle
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] how to make UISwipeGestureRecognizer work in a view with other gesture recognizers tvOS

 September 29, 2022     objective-c, tvos     No comments   

Issue

My UITapGestureRecognizer gestures work as they supposed to but I've been trying to Add UISwipeGestureRecognizer to my tvOS app but when I test it with the simulator it does not work!

here is my code :

- (void)addScreenControlGesturesRecognizers {
    UITapGestureRecognizer *_oneTapMediaControl = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTapMediaControl:)];
    _oneTapMediaControl.numberOfTapsRequired = 1;
    _oneTapMediaControl.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypeSelect]];

    [self.view addGestureRecognizer:_oneTapMediaControl];

    UITapGestureRecognizer *_doubleTapMediaControl = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleDoubleTapControl:)];
    _doubleTapMediaControl.numberOfTapsRequired = 2;
    _doubleTapMediaControl.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypeSelect]];

    [self.view addGestureRecognizer:_doubleTapMediaControl];

    [_oneTapMediaControl requireGestureRecognizerToFail:_doubleTapMediaControl];

    UISwipeGestureRecognizer *_swipeGesturesControl = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeGestureRecognizer:)];
    _swipeGesturesControl.direction = UISwipeGestureRecognizerDirectionLeft;
    [self.view addGestureRecognizer:_swipeGesturesControl];

}

- (void)handleSwipeGestureRecognizer:(UISwipeGestureRecognizer *)recognizer {
        NSLog(@"Swipe Left"); 
}

Solution

You have to set your gesture recognizer to work simultaneously with other gesture recognizer. Please use UIGestureRecognizerDelegate's method

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    return YES;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
    return YES;
}


Answered By - SergStav
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to move focus at button in collectionview cell in tvos application?

 September 29, 2022     apple-tv, ios, tvos, tvos10, tvos9.1     No comments   

Issue

I am working on apple TV application. In my app, I have made a screen which has a collection view. In that case, I am able to move focus at collection view cell but not able to move focus to the button which is in collection view cell so can anyone help me to solve this issue ?

please give me an answer if anyone knows this answer.


Solution

I am able to solve this problem by adding below methods in collectionViewCell subclass.

In CollectionViewCell Subclass

override var preferredFocusEnvironments: [UIFocusEnvironment]{
    // Condition
}
override func shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool {
    // Condition
}
override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
    // Condition
}

you can see more at this link: enter link description here.



Answered By - vikas prajapati
Answer Checked By - Terry (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How do I play a video on tvOS for Apple TV?

 September 29, 2022     apple-tv, tvos, xcode     No comments   

Issue

I started a blank tvOS project and created the following code:

- (void)viewDidLoad  
{  
    [super viewDidLoad];  

    AVPlayer *avPlayer = [AVPlayer playerWithURL:[NSURL URLWithString:@"http://www.myurl.com/myvideo.mp4"]];  
    AVPlayerLayer *avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayer];  

    avPlayerLayer.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);  
    [self.view.layer addSublayer:avPlayerLayer];  

    [avPlayer play];  
}  

Nothing happens in the simulator though once the app loads. No video, nothing, just a blank translucent screen in my Apple TV simulator.

What's the proper way to play a sample video on app launch for an Apple TV app from an HTTP source?


Solution

I just pasted your code in my tvOS sample project, replaced the URL and ran it.

Nothing happened. Well, except for the fact that there's a log entry telling me that App Transport Security has blocked my URL request.

So I headed to the Info.plist, disabled ATS and upon next launch the video showed up just fine.

So if you're also using a non-HTTPS URL you're very likely running into this issue which is easily fixed by either using an HTTPS URL, disabling ATS completely or allowing specific non-HTTPs URLs in your Info.plist.

P.S.: I used this video for testing.



Answered By - lemonmojo
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing