(tvOS) m3u8 url can't play

# I chage my question.


tvOS 9.0(13T5365h)

XCode 7.1


I can install "TVMLCatalogUsingTVMLTemplate" that Apple provide to new AppleTV.

I modified "Catalog.xml.js", then I would like to play m3u8 movie.


<lockup videoURL="http://st.testdomain.com/test.m3u8">
<img src="${this.BASEURL}resources/images/music/music_1.lcr" width="308" height="308" />
<title class="whiteText">test_movie</title>
</lockup>


And, I modified "Presenter.js" as following.

var Presenter = {
    defaultPresenter: function(xml) {
        if(this.loadingIndicatorVisible) {
            navigationDocument.replaceDocument(xml, this.loadingIndicator);
            this.loadingIndicatorVisible = false;
        } else {
            navigationDocument.pushDocument(xml);
        }
    },
    modalDialogPresenter: function(xml) {
        navigationDocument.presentModal(xml);
    },
    menuBarItemPresenter: function(xml, ele) {
        var feature = ele.parentNode.getFeature("MenuBarDocument");
        if (feature) {
            var currentDoc = feature.getDocument(ele);
            if (!currentDoc) {
                feature.setDocument(xml, ele);
            }
        }
    },
    load: function(event) {
        console.log(event);

        var self = this,
            ele = event.target,
            templateURL = ele.getAttribute("template"),
            presentation = ele.getAttribute("presentation"),
            videoURL = ele.getAttribute("videoURL");
        if(videoURL) {
                var player = new Player();
                var playlist = new Playlist();
                var mediaItem = new MediaItem("video", videoURL);
                player.playlist = playlist;
                player.playlist.push(mediaItem);
                player.present();
        }
        if (templateURL) {
            self.showLoadingIndicator(presentation);
            resourceLoader.loadResource(templateURL,
                function(resource) {
                    if (resource) {
                        var doc = self.makeDocument(resource);
                        doc.addEventListener("select", self.load.bind(self));
                        doc.addEventListener("highlight", self.load.bind(self));
                        if (self[presentation] instanceof Function) {
                            self[presentation].call(self, doc, ele);
                        } else {
                            self.defaultPresenter.call(self, doc);
                        }
                    }
                }
            );
        }
    },
    makeDocument: function(resource) {
        if (!Presenter.parser) {
            Presenter.parser = new DOMParser();
        }
        var doc = Presenter.parser.parseFromString(resource, "application/xml");
        return doc;
    },
    showLoadingIndicator: function(presentation) {
        if (!this.loadingIndicator) {
            this.loadingIndicator = this.makeDocument(this.loadingTemplate);
        }
        if (!this.loadingIndicatorVisible && presentation != "modalDialogPresenter" && presentation != "menuBarItemPresenter") {
            navigationDocument.pushDocument(this.loadingIndicator);
            this.loadingIndicatorVisible = true;
        }
    },
    removeLoadingIndicator: function() {
        if (this.loadingIndicatorVisible) {
            navigationDocument.removeDocument(this.loadingIndicator);
            this.loadingIndicatorVisible = false;
        }
    },
    loadingTemplate: `<?xml version="1.0" encoding="UTF-8" ?>
        <document>
          <loadingTemplate>
            <activityIndicator>
              <text>Loading...</text>
            </activityIndicator>
          </loadingTemplate>
        </document>`
}


I could play video contents. But, anytime play video....

I would like to play video when I click the icon.


How can I do it?

I noticed that your movie URL is "http" and not "https". Have you included Application Transport Security exceptions for the domain in question in your Info.plist?

Were you able to get an m3u8 to play? I'm trying to play a live stream and i'm not having luck either.

You must invoke the player's play method https://developer.apple.com/library/prerelease/tvos/documentation/TVMLJS/Reference/TVJSPlayer_Ref/index.html#//apple_ref/javascript/instm/Player/play:

var mediaItem = new MediaItem("video", videoURL);
player.playlist = playlist; 
player.playlist.push(mediaItem);
player.play()

Yes. I configured the temporary exceptions of Info.plist file.

Yes. I confirmed to play the m3u8 on iPhone native player.

Were you able to resolve this? I've been able to get it to play (and have a configuration almost exactly like yours), but now the video starts playing automatically even before I click on it. Thinking I may need to include the video player code in another place ...

(tvOS) m3u8 url can't play
 
 
Q