rrirower / DP2SceneGraphWizard

Direct Publisher to SceneGraph wizard.
MIT License
15 stars 1 forks source link

Deep link bug? #63

Closed EHBradford closed 7 months ago

EHBradford commented 7 months ago

Having zero success with deep linking from a version I downloaded in November so I took the plunge and downloaded/ran everything from scratch yesterday.

After a lot of minor-ish glitches I got everything working sufficiently well except deep-linking.

After researching the deep-linking code it appears there may be a bug in an IF-ELSE IF-END block of code that caused my shortFormVideos to not deep-link.

In the DeepLinkingLogic.brs file the following code exists:


       playableItem = FindNodeById(content, contentId) ' find content for deep linking by contentId
    if playableItem <> invalid
        ' I added following for debugging purposes
        'print "  PLAYABLE FOUND"
        SetPlayAllFlag(playableItem, false)
    ' I added following else block for debugging purposes
    else
        'print "  PLAYABLE NOT FOUND"
    end if
    ' Check for a valid playable item.  An item is typically not valid due to an invalid content id.
    if playableItem <> invalid
        ClearScreenStack() ' remove all screen from screen stack except GridScreen

        ' Episodes and Movies.
        if mediaType = "episode" or mediaType = "movie"
            ' See if the content can be resumed.
            if contentBookmark.VideoCanBeResumed(playableItem.id, position) = true
                playableItem.PlayStart = position[0]
            end if
            ShowVideoScreen(playableItem, 0)
            ' Short form videos.
        else if playableItem.mediaType = "shortFormVideo"
            ShowVideoScreen(playableItem, 0)
            ' TV specials.
        else if playableItem.mediaType = "tvSpecial"
            if contentBookmark.VideoCanBeResumed(playableItem.id, position) = true
                playableItem.PlayStart = position[0]
            end if
            ShowVideoScreen(playableItem, 0)
            ' Series.
        else if mediaType = "series"
            ' Get the Episode to play based on Bookmark history.
            playableItem = contentBookmark.SeriesCanBeResumed(playableItem, position)
            SetPlayAllFlag(playableItem, false)
            if playableItem <> invalid
                playableItem.PlayStart = position[0]
                contentBookmark.UpdateSmartBookmark()
            end if
            ShowVideoScreen(playableItem, 0, true)
        end if

FYI, My JSON feed only has shortFormVideos in it.

When I try deep linking with the deep-links-tester playableItem.mediaType returns 'series' thus the logic as presented above never plays any of my videos.

If I change the code to this then deep-linking works just fine:


       playableItem = FindNodeById(content, contentId) ' find content for deep linking by contentId
    if playableItem <> invalid
        ' I added following for debugging purposes
        'print "  PLAYABLE FOUND"
        SetPlayAllFlag(playableItem, false)
    ' I added following else block for debugging purposes
    else
        'print "  PLAYABLE NOT FOUND"
    end if
    ' Check for a valid playable item.  An item is typically not valid due to an invalid content id.
    if playableItem <> invalid
        ClearScreenStack() ' remove all screen from screen stack except GridScreen

        ' Episodes and Movies.
        if mediaType = "episode" or mediaType = "movie"
            ' See if the content can be resumed.
            if contentBookmark.VideoCanBeResumed(playableItem.id, position) = true
                playableItem.PlayStart = position[0]
            end if
            ShowVideoScreen(playableItem, 0)
            ' Short form videos.
        else if mediaType = "shortFormVideo"
            ShowVideoScreen(playableItem, 0)
            ' TV specials.
        else if playableItem.mediaType = "tvSpecial"
            if contentBookmark.VideoCanBeResumed(playableItem.id, position) = true
                playableItem.PlayStart = position[0]
            end if
            ShowVideoScreen(playableItem, 0)
            ' Series.
        else if mediaType = "series"
            ' Get the Episode to play based on Bookmark history.
            playableItem = contentBookmark.SeriesCanBeResumed(playableItem, position)
            SetPlayAllFlag(playableItem, false)
            if playableItem <> invalid
                playableItem.PlayStart = position[0]
                contentBookmark.UpdateSmartBookmark()
            end if
            ShowVideoScreen(playableItem, 0, true)
        end if

I'm not going to go any further with this issue since it appears I have what I need and fixing this bug would require a lot of time researching the author's intent in the playable object, the mediaType variable and subsequently in the IF-ELSE IF-END block of code where they seem to be mixed in randomly.

Thanks for the great code, I really appreciate it, and I hope this issue report helps someone out there who just cannot seem to get deep-linking working.

rrirower commented 7 months ago

Can you provide the URL to your feed file so I can test this?

rrirower commented 7 months ago

I've tested the code with a feed file that contains mixed content types and 'shortFormVideos' deep link correctly. I need your URL to see if there's something different when sfv is the only content type.

EHBradford commented 7 months ago

Can't provide the actual json but this is formatted the same way and exhibits the same behavior as noted in the original report above:

{"providerName":"Testit","language":"en-us","lastUpdated":"2023-12-22T01:23:22+00:00","shortFormVideos":[{"id":"46369","title":"Big Buck Bunny","shortDescription":"Big Buck Bunny","longDescription":"Big Buck Bunny longer","thumbnail":"https:\/\/storage.googleapis.com\/gtv-videos-bucket\/sample\/images\/BigBuckBunny.jpg","releaseDate":"2023-12-22T01:23:22+00:00","tags":["Trending","Bunny"],"genres":["news"],"content":{"dateAdded":"2023-12-22T01:23:22+00:00","duration":594,"videos":[{"url":"https:\/\/commondatastorage.googleapis.com\/gtv-videos-bucket\/sample\/BigBuckBunny.mp4","quality":"HD","videoType":"MP4","bitrate":1000}]}},{"id":"46363","title":"Elephant Dream","shortDescription":"Elephant Dream","longDescription":"Elephant Dream longer","thumbnail":"https:\/\/storage.googleapis.com\/gtv-videos-bucket\/sample\/images\/ElephantsDream.jpg","releaseDate":"2023-12-19T16:58:00+00:00","tags":{"1":"Elephant","0":"Trending"},"genres":["news"],"content":{"dateAdded":"2023-12-19T16:58:00+00:00","duration":654,"videos":[{"url":"https:\/\/commondatastorage.googleapis.com\/gtv-videos-bucket\/sample\/ElephantsDream.mp4","quality":"HD","videoType":"MP4","bitrate":1000}]}},{"id":"46374","title":"For Bigger Blazes","shortDescription":"For Bigger Blazes","longDescription":"For Bigger Blazes longer","tags":{"1":"Blazes","0":"Trending"},"genres":["news"],"thumbnail":"https:\/\/storage.googleapis.com\/gtv-videos-bucket\/sample\/images\/ForBiggerBlazes.jpg","releaseDate":"2023-12-22T01:23:22+00:00","content":{"dateAdded":"2023-12-22T01:23:22+00:00","duration":15,"videos":[{"url":"https:\/\/commondatastorage.googleapis.com\/gtv-videos-bucket\/sample\/ForBiggerBlazes.mp4","quality":"HD","videoType":"MP4","bitrate":1000}]}},{"id":"46353","title":"For Bigger Escapes","shortDescription":"For Bigger Escapes","longDescription":"For Bigger Escapes longer","tags":["Trending","Blazes"],"genres":["news"],"thumbnail":"https:\/\/storage.googleapis.com\/gtv-videos-bucket\/sample\/images\/ForBiggerEscapes.jpg","releaseDate":"2023-12-22T01:23:22+00:00","content":{"dateAdded":"2023-12-22T01:23:22+00:00","duration":15,"videos":[{"url":"https:\/\/commondatastorage.googleapis.com\/gtv-videos-bucket\/sample\/ForBiggerEscapes.mp4","quality":"HD","videoType":"MP4","bitrate":1000}]}}],"categories":[{"name":"Trending","playlistName":"Trending","order":"most_recent"},{"name":"Big Buck Bunny","playlistName":"Big Buck Bunny","order":"most_recent"},{"name":"Elephant Dream","playlistName":"Elephant Dream","order":"most_recent"},{"name":"For Bigger Blazes","playlistName":"For Bigger Blazes","order":"most_recent"},{"name":"For Bigger Escape","playlistName":"For Bigger Escape","order":"most_recent"}],"playlists":[{"name":"Trending","itemIds":["46369","46363","46374","46353"]},{"name":"Big Buck Bunny","itemIds":["46369"]},{"name":"Elephant Dream","itemIds":["46363"]},{"name":"For Bigger Blazes","itemIds":["46374"]},{"name":"For Bigger Escape","itemIds":["46353"]}]}

rrirower commented 7 months ago

You can't provide the URL?

rrirower commented 7 months ago

Your feed file is malformed. It produces errors when I try to load it into the Channel Feed Manager. Specifically, your 'tag' fields are using "{" and "}" when it should use "[" and "]". This will cause problems when the feed file is parsed.

EHBradford commented 7 months ago

Unfortunately no, I cannot give you the link to my JSON feed.

You are correct. In the sample JSON above I absolutely incorrectly formatted the tags element of the 2nd, 3rd, and 4th items.

I corrected the three small errors and found the results are the same, when deep-linking to the 1st shortFormVideo (id=46369 , media=shortFormVideo) the result is the same. A blank screen.

I subsequently went on to find Roku's sample JSON as posted online for developers. it can be found at the following location:

https://devtools.web.roku.com/samples/roku-developers-feed-v1-rdp.json

The above JSON feed is documented at the following link:

https://developer.roku.com/docs/specs/direct-publisher-feed-specs/json-dp-spec.md

When using the above Roku supplied JSON feed I am finding the that the channel's deep-linking algorithms cannot seem to locate

Id = dev-summit-21-keynote-welcome-address mediaType = shortFormVideo.

Using the Roku supplied JSON, the channel's behavior is different, but similar. In the case of my particular data set the channel's deep-linking algorithms hang the channel and nothing but a blank screen apears, as I would expect given the logic above I briefly looked at, then corrected (it works, whether the proper correction. I do not know).

While using the JSON from Roku the channel's deep-linking algorithms produced a pop-up message saying the content cannot be located:

tempImageW1m0d1

BTW, The word developer is misspelled on the above popup message.

Those are my findings. I believe with the correction I applied, as shown in my original posting, I have a working channel for my circumstances. BTW, my change was as follows:

else if playableItem.mediaType = "shortFormVideo" to

else if mediaType = "shortFormVideo"

As to why there are multiple different comparison variables (playableItem.mediaType as well as mediaType) used in that IF-THEN-ELSE IF-END block I cannot speak to that since I am not familiar with the reasoning behind the logic.

As to why there is an issue with the Roku supplied data I suggest you give the Roku JSON a try. If it works then fantastic, if not then perhaps that is something you might want to explore further.

Thank you again and have a great day.

rrirower commented 7 months ago

Can you tell me what version of the code you're using?

EHBradford commented 7 months ago

Just downloaded and confirmed the configurator is the same I used three days ago, it is..... The configurator produces in the manifest:

Channel Details

Auto-generated by DPtoSceneGraph wizard version 1.0.0.0-alpha-8.1+657d48d4f9e549a1b4054cef74f1531ed6059d60

(c) Copyright 2023, Michael Harnad, All rights reserved.

Support at https://github.com/rrirower

ferdiworks commented 7 months ago

@EHBradford You wrote: Unfortunately no, I cannot give you the link to my JSON feed. Note: There can be many reasons you cannot get the channel to work! Please note without the proper feed URL showing where your videos are hosted, What format they are in, Do they require trickplay or not, Where the images are hosted and do you have the proper bandwidth for the images and videos and do they load fast or slow, ARE THEY LEGAL CONTENT or NOT? We can waste time looking at 1000s of feeds and the codes but the sad truth is we need to see your feed to evaluate the error, problem or item to correct for your feedd to work! Note: I myself as a developer get thousands of developers from around the world contacting me to fix their client's feeds or code because they are lost and do not have knowledge of proper JSON Feed coding and they don't want to lose a client and they are in a rush before Jan 2024 to save the channel! So please help us help you and post the URL of the Hosted JSON Feed filed so we can access the issues!

rrirower commented 7 months ago

@EHBradford I may have found a bug. And, it's not in the DeepLinkinig code. I noticed that the Roku sample feed you posted did not display all of the content on the screen. I tried deep linking to a couple of items and found that it did not work as expected. I then found that the feed file defined tags that did not associate with a defined Category while at the same time defining a Playlist that contained the content item. The loading code does not account for an item that is defined with tags AND is listed in a playlist. I'll need to investigate further...

rrirower commented 7 months ago

@EHBradford @ferdiworks I've found the bug. It was complicated by the fact that the Roku sample feed doesn't follow its spec. That led me down the wrong path. Eventually, I found that deep linking would not work with a feed file that contained ONLY a Playlist of items. I've corrected that and hope to publish a fix soon. But, with the upcoming Holiday, I'm not sure when.

rrirower commented 7 months ago

Resolved in Beta1.

EHBradford commented 7 months ago

The spec sample file looked pretty good to me. But I certainly have not attempted to compare the spec file to their documentation, i.e. a lot of work. So, I am flying blind. Admittedly my fault assuming the Roku spec file is incorrect.

It would be nice if you think the spec file provided by Roku is bad that you provide a corrected version and an explanation of the changes you made that fix the spec file. Basically, at this moment you have your diagnosis which Others and I are not privileged to be aware of at this moment. We are developing off what Roku says is correct.

It will be very difficult to develop to what you think the spec is actually, which I believe is not written currently detailed.

rrirower commented 7 months ago

@EHBradford I did not fix the feed file. I fixed a bug in the software to resolve a condition that should not exist in their file. It's not my responsibility to resolve issues found with Roku files.

EHBradford commented 7 months ago

Okay, Have a great day!