Jump to content

Streaming api examples


Luke

Recommended Posts

For those who are not using our StreamBuilder library

 

@@darwindeeds

@@xnappo

@@Redshirt (although you should eventually)

 

The roku source code should now be considered the new model for which to extract sample code:

 

https://github.com/MediaBrowser/MediaBrowser.Roku/blob/master/source/VideoMetadata.brs#L201

 

It supports all of the latest api features, including MediaSources, user-configured language preferences, channels, live tv and regular media. It does not yet support the new text subtitle api because that is not in the release server, but it soon will be.

 

The most important thing about this code is what it uses to evaluate media info, as well as what it does not use.

 

This code does not examine any of the following characteristics:

 

  • LocationType
  • VideoType
  • IsoType
  • Path
  • Item type (e.g. movie, episode, channel item, live tv, etc)

 

Your code should not be using this information either, except in direct play over the file system scenarios. If you follow these guidelines you will be able to play any content regardless of the source, and you'll be able to support user configuration.

  • Like 3
Link to comment
Share on other sites

im85288

Luke I'm not sure if this is related to the changes you've made but I noticed now that some systems (eg Sonos playbar) does not accept DTS but will work fine with AC3. I hate to mention Plex but I recall there was an option on the server to say not to output DTS. I can see how to do this on the client but think maybe the option should be on the server as it is/was done in plex?

Link to comment
Share on other sites

im85288

Ok, is that sufficient as a FR or do you need more info? Is it something foreseen to do or out the question.

Link to comment
Share on other sites

chef

Geez Louise! This Roku code looks like Visual Basic, but obviously it is bright script

Edited by chef
Link to comment
Share on other sites

Koleckai Silvestri

Basic is Basic... Brightscript is just a form of Basic as far as I understand it.

Link to comment
Share on other sites

Ok, is that sufficient as a FR or do you need more info? Is it something foreseen to do or out the question.

 

feel free to create a topic

Link to comment
Share on other sites

Redshirt

Man there's a never ending rabbit hole of model classes. Been converting the streambuilder to java. I really hope its worth it.

Link to comment
Share on other sites

well i don't want you to convert, i want you to use them. so tell me what's preventing that so that you don't have to do that. is it just the serializable tag?

 

also i have a couple recruits who may start some of the hand-coding for ApiClient. so they'll be able to do what's needed so that you can just use it.

  • Like 1
Link to comment
Share on other sites

Redshirt

Some of these classes may be able to be stripped out as they won't be used by clients. But Issues that I can see. 

 

  1. MediaBrowser.Model.ApiClient.GeneralCommandEventArgs cannot extend System.EventArgs
  2. MediaBrowser.Model.ApiClient.HttpResponseEventArgs cannot extend System.EventArgs
  3. MediaBrowser.Model.ApiClient.HttpResponseEventArgs cannot resolve System.Net.HttpStatusCode
  4. MediaBrowser.Model.ApiClient.SessionUpdatesEventArgs cannot extend System.EventArgs
  5. MediaBrowser.Model.Channels.ChannelFeatures new Integer() is not legal syntax
  6. MediaBrowser.Model.Channels.ChannelItemQuery new Integer() and new SortOrder() are not legal syntax
  7. MediaBrowser.Model.Configuration.ChannelOptions new Integer() is not legal syntax
  8. MediaBrowser.Model.Configuration.MetadataOptions Contains(string, StringComparer) method doesn't exist and StringComparers don't exist either
  9. MediaBrowser.Model.Configuration.NotificationOptions Same issues as 8 and also ToString() shouldn't be called on String based enums
  10. MediaBrowser.Model.Configuration.ServerConfiguration TimeSpan class doesn't exist in java. Why not hard code 5 * 60 or 300
  11. MediaBrowser.Model.Dlna.AudioOptions Same as 5
  12. MediaBrowser.Model.Dlna.ContentFeatureBuilder trim() needs to be a string not a char. So " instead of '
  13. MediaBrowser.Model.Dlna.DeviceProfile  Same as 5. Also TrimStart() doesn't exist
  14. MediaBrowser.Model.Dlna.DlnaFlags SenderPaced property initialization is a long being passed into an int method. compilation will fail.
  15. MediaBrowser.Model.Dlna.DlnaMaps  Cannot use | for FlagsToString method. Also cannot cast (long)flags
  16. MediaBrowser.Model.Dlna.EventSubscription AddSeconds() and java.util.Date.UtcNow don't exist
  17. MediaBrowser.Model.Dlna.Filter StringSplitOptions doesn't exist
  18. MediaBrowser.Model.Dlna.MediaFormatProfileResolver cannot return Object[]. Need to return something that implements java.lang.Iterable
  19. MediaBrowser.Model.Dlna.StreamBuilder i.getConditions returns an array which addAll() can't handle. needs to be something that is implements java.util.Collection
  20. MediaBrowser.Model.Dlna.StreamBuilder all calls to IsVideoConditionSatisfied. Cannot convert a Float to a Double. videoFrameRate. 
  21. MediaBrowser.Model.Dlna.StreamInfo new Integer(), new Double(), new Long() are not valid syntax. 
  22. MediaBrowser.Model.Dto.BaseItemDto cannot implement INotifyPropertyChanged
  23. MediaBrowser.Model.Dto.BaseItemDto new Integer(), new Float(), new Boolean(), new Long(), new Double(), new Video3DFormat(), new SeriesStatus(), new VideoType(), new IsoType() are not valid syntax
  24. MediaBrowser.Model.Dto.BaseItemDto System.DayOfWeek doesn't have a Java equivalent
  25. MediaBrowser.Model.Dto.BaseItemDto All uses of java.util.Date. Code will compile, but I don't think the strings received will actually convert to date objects. All date variables may need to be String instead
  26. MediaBrowser.Model.Dto.BaseItemDto MediaType enum shouldn't have Entities. in front of it. It should either be just MediaType.Video or MediaBrowser.Model.Entities.MediaType.VIdeo.
  27. MediaBrowser.Model.Dto.BaseItemPerson Same as 22
  28. MediaBrowser.Model.Dto.ChapterInfoDto Same as 22
  29. MediaBrowser.Model.Dto.ImageInfo Same as 5
  30. MediaBrowser.Model.Dto.ImageOptions new Integer() and new Boolean() are not valid syntax
  31. MediaBrowser.Model.Dto.MediaSourceInfo new Integer(), new long(), new VideoType(), new IsoType(), new Video3DFormat(), new TransportStreamTimeStamp() are not valid syntax
  32. MediaBrowser.Model.Dto.UserDto new Double() isn't valid syntax
  33. MediaBrowser.Model.Dto.userItemDataDto new Double() and new Boolean() are not valid syntax

 

I'll add more later. These issues are just the ones that causing compile to fail. I haven't yet identified any issues that will present at runtime, or classes that just weren't converted at all for whatever reason. Also, I haven't added line numbers because the issues are typically happening all over those files.

 

Enums where you've assigned a numeric value to each item are converted to java in a strange fashion. Have a look at how MediaBrowser.Model.Library.PlayAccess is converted and how it's referenced in BaseItemDto. If there's no number you can do something like if (playAccess.equals(PlayAccess.Full)). Which is a lot more readable than if (playAccess.equals(getPlayAccess().values()[0])

Edited by Redshirt
Link to comment
Share on other sites

Redshirt

Actually looking into the json de-serializer that I'm using, it looks like I can specify the date format to use when encountering any date strings. So that means #25 may not be an issue at all.

Link to comment
Share on other sites

ok, we're going to start withing with it by hand, so that stuff will all get resolved.

Link to comment
Share on other sites

im85288

feel free to create a topic

 

No problem, I've added it to my client preferences instead.

Link to comment
Share on other sites

chef

@@chef do i see some roku pull requests in your future? :)

It would be nice to help code something that works ;)

 

I would also have to but a Roku. I will let you know when I am set up.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
darwindeeds

Luke, when you handle the audio track picker how do you decide which one is the default to pick (when the user starts the playback)? I assume you want pick the one that is optimal for direct play, correct?

What if the audio track apt for direct play is of different language from the user's default language?

Link to comment
Share on other sites

Actually media sources have a DefaultAudioStreamIndex and DefaultSubtitleStreamIndex property. Use those as they take care of all of that, including user language preferences. Take a look at the Roku source code.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...