Jump to content

IMediaPlayer interface


wolfbuddy

Recommended Posts

wolfbuddy

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

wolfbuddy

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

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

wolfbuddy

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

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 by Aphid
Link to comment
Share on other sites

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

wolfbuddy

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

wolfbuddy

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

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

  • 1 month later...

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...