wolfbuddy 16 Posted February 2, 2015 Share Posted February 2, 2015 Hi, Apologies in advance for the noobish question. How do I access the variables in the interface MediaBrowser.Theater.Interfaces.Playback.IMediaPlayer? I need to get CurrentDurationTicks. I tried to insert it into my constructor, the same as IPlaybackManager, but I get null reference exceptions. I guess it's built in a different way but my skills are not up to figuring out how! I think I might need to implement it in the usual interface way, by creating a new class and inheriting IMediaPlayer but this all new to me. Thanks Link to comment Share on other sites More sharing options...
wolfbuddy 16 Posted February 4, 2015 Author Share Posted February 4, 2015 Anyone that can help with this? I've taken a look at how the MBT UI does this, and tried to replicate that in my plugin, but I get the following in the MBT log. 2015-02-03 13:56:13.5500 Error - App: Error creating SimpleInjector.ActivationException: No registration for type iMonHandler could be found and an implicit registration could not be made. The constructor of type iMonHandler contains the parameter of type IMediaPlayer with name 'mediaPlayer' that is not registered. Please ensure IMediaPlayer is registered in the container, or change the constructor of iMonHandler. ---> SimpleInjector.ActivationException: The constructor of type iMonHandler contains the parameter of type IMediaPlayer with name 'mediaPlayer' that is not registered. Please ensure IMediaPlayer is registered in the container, or change the constructor of iMonHandler. at SimpleInjector.Advanced.DefaultConstructorInjectionBehavior.GetInstanceProducerFor(ParameterInfo parameter) at SimpleInjector.Advanced.DefaultConstructorInjectionBehavior.BuildParameterExpression(ParameterInfo parameter) at SimpleInjector.ContainerOptions.BuildParameterExpression(ParameterInfo parameter) at SimpleInjector.Registration.BuildConstructorParameters(ConstructorInfo constructor) at SimpleInjector.Registration.BuildNewExpression(Type serviceType, Type implementationType) at SimpleInjector.Registration.BuildTransientExpression[TService,TImplementation]() at SimpleInjector.Lifestyles.TransientLifestyle.TransientLifestyleRegistration`2.BuildExpression() at SimpleInjector.Registration.BuildExpression(InstanceProducer producer) at SimpleInjector.InstanceProducer.BuildExpressionInternal() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.get_Value() at SimpleInjector.InstanceProducer.BuildInstanceCreator() at SimpleInjector.InstanceProducer.GetInstance() --- End of inner exception stack trace --- at SimpleInjector.InstanceProducer.GetInstance() at SimpleInjector.Container.GetInstance(Type serviceType) Link to comment Share on other sites More sharing options...
ebr 14948 Posted February 4, 2015 Share Posted February 4, 2015 What are you trying to build? I'm not sure MBT is ready for plug-in development. Anything you do is likely to have to change when the new framework is complete. Link to comment Share on other sites More sharing options...
wolfbuddy 16 Posted February 4, 2015 Author Share Posted February 4, 2015 This; http://mediabrowser.tv/community/index.php?/topic/17234-feature-request-soundgraph-imon-support/ I just need some basic media information from the media player, which I'm getting currently from the playback started event. However, I need to update the display with the current duration which I can't figure out how to retrieve. The MBT UI does it no problem so I'm sure that I must be able to!? I don't mind re-writing it if/when the new MBT is done. It's all a good learning curve. Link to comment Share on other sites More sharing options...
ebr 14948 Posted February 4, 2015 Share Posted February 4, 2015 @@Aphid can you help him out? Link to comment Share on other sites More sharing options...
Aphid 212 Posted February 4, 2015 Share Posted February 4, 2015 (edited) The playback started event has a Player property on it which contains the IMediaPlayer instance being used for the current item. The media player has the current duration. Edited February 4, 2015 by Aphid Link to comment Share on other sites More sharing options...
Aphid 212 Posted February 4, 2015 Share Posted February 4, 2015 The playback manager and related interfaces is what I am currently working on, and will change quite significantly in an upcoming release. Link to comment Share on other sites More sharing options...
wolfbuddy 16 Posted February 4, 2015 Author Share Posted February 4, 2015 The playback started event has a Player property on it which contains the IMediaPlayer instance being used for the current item. The media player has the current duration. Thanks, yeah I have this but I want to get the current duration periodically to update the iMon displays with it. Link to comment Share on other sites More sharing options...
wolfbuddy 16 Posted February 4, 2015 Author Share Posted February 4, 2015 Can I get PositionTicks from MediaBrowser.Model.Session.PlaybackProgressInfo? I think that MBT is setting this during playback? Link to comment Share on other sites More sharing options...
Aphid 212 Posted February 5, 2015 Share Posted February 5, 2015 MBT remembers the player from the last playback started event, and periodically polls it. In the future, there will be a playback state event from which you can get this information. Link to comment Share on other sites More sharing options...
wolfbuddy 16 Posted February 5, 2015 Author Share Posted February 5, 2015 OK, thanks. Any idea when this will be available? Link to comment Share on other sites More sharing options...
wolfbuddy 16 Posted March 10, 2015 Author Share Posted March 10, 2015 Hi, Any news on this? Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now