Jump to content


Photo

How to start MediaPlayer addon with other addon


  • Please log in to reply
7 replies to this topic

#1 jasko

  • Member
  • 11 posts

0
Neutral

Posted 9 November 2014 - 16:38

Hello to all devs.

 

I develped a addon that can play streams from web it works ok on default OpenPLI MoviePlayer.

 

this is what i use to start default MoviePlayer:

from Screens.InfoBar import MoviePlayer as MP_parent

fileRef = eServiceReference(4097,0,test)
fileRef.setName(test1)
self.session.open(MoviePlayer, fileRef) ...

Now i want to start stream with MediaPlayer addon from Extensions

 

If i add this code to start MediaPlayer it opens Mediaplayer file list browser

from Plugins.Extensions.MediaPlayer.plugin import MediaPlayer

fileRef = eServiceReference(4097,0,test)
fileRef.setName(test1)
self.session.open(MediaPlayer, fileRef) ...

How can i start play stream with MediaPlayer?

 

what is missing in my code?

 

BR



Re: How to start MediaPlayer addon with other addon #2 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 10 November 2014 - 12:08

I think mediaplayer uses movieplayer to play stream as you did in first code



Re: How to start MediaPlayer addon with other addon #3 jasko

  • Member
  • 11 posts

0
Neutral

Posted 10 November 2014 - 12:45

Yes i can play iptv on MoviePlayer but no subssupport plugin with it.

 

On MediaPlayer2 is a subssupport plugin in it.

 

Is it possible to start MediaPlayer to play stream?

 

With the second code i opens only filelist dont start stream.



Re: How to start MediaPlayer addon with other addon #4 MiLo

  • PLi® Core member
  • 14,042 posts

+298
Excellent

Posted 10 November 2014 - 14:41

Just look in the MediaPlayer code what it uses to start playback. Probably just another "Screen" class to launch.
Real musicians never die - they just decompose

Re: How to start MediaPlayer addon with other addon #5 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 10 November 2014 - 16:08

No special player  for mediaplayer, all plugins uses movieplayer as it is or customized.

mediaplayer import the subtitles support by this code

 

from Screens.AudioSelection import SubtitleSelection
self.session.open(SubtitleSelection, self)



Re: How to start MediaPlayer addon with other addon #6 jasko

  • Member
  • 11 posts

0
Neutral

Posted 11 November 2014 - 10:09

Thanks to all for reply

 

This is what i try to do.

 

https://code.google....layer2-for-sh4/



Re: How to start MediaPlayer addon with other addon #7 mfaraj57

  • Senior Member
  • 1,605 posts

+286
Excellent

Posted 11 November 2014 - 16:56

Importing mediaplayer2 to play subs is complicated and no need for that

you can make customized movieplayer and add subssupport,i think this a lot easier

look into the code of mediaportal,XBMCaddons and TSmedia how they made customized movie player

and add subssupport as the following code demonstrate

when start playing movie by remote text button you can select srt file 



import Queue
import random
import os
from Screens.InfoBarGenerics import *

from Components.Pixmap import MovingPixmap
from enigma import  eServiceReference, iServiceInformation, iPlayableService
from Components.ServiceEventTracker import ServiceEventTracker



from ServiceReference import ServiceReference

from Screens.PVRState import PVRState, TimeshiftState

def getserviceinfo(sref):
              try:
	        p=ServiceReference(sref)
	        servicename=str(p.getServiceName())
	        serviceurl=str(p.getPath())
	        return servicename,serviceurl
	      except:
                return None,None
                
try:
    from Plugins.Extensions.SubsSupport import SubsSupport, initSubsSettings
except ImportError as e:
    traceback.print_exc()
    raise Exception("Please install SubsSupport plugin")
    
 
hostname=gethostname()    
currversion,currkernel=getversions()                 
def checkmmssupport(servicepath=None):
    if servicepath is None:
       return True
    if servicepath.startswith('mms') and currkernel=='1.6':
       return False
    else:
       return True
def checkrtmpsupport(servicepath=None):
    if servicepath is None:
       return True
    if os.path.exists("/usr/lib/librtmp.so.0")==False and os.path.exists("/usr/lib/librtmp.so.1")==False :
       return False
    else:
       return True       
                            
class TSMplayer4(Screen,InfoBarBase,SubsSupport, InfoBarSeek, InfoBarNotifications,InfoBarPVRState,InfoBarShowHide, InfoBarAudioSelection, InfoBarSubtitleSupport):
	ENABLE_RESUME_SUPPORT = True
	ALLOW_SUSPEND = True
        
	def __init__(self, session, sref,addon_params={},plugin_id=None,playlist=[],playindex=0,playall=False,noexit=False,referer=None,serviceName=None,audio=None,mode='appversion4'):

		Screen.__init__(self, session)
		self.audio=audio
		if 'audio' in plugin_id:
		   self.audio=True
		print "54noexit",noexit
		print "54referer",referer

		self.playlist=playlist
		self.addon_params=addon_params
		self.long_plugin_id=plugin_id
		self.mode=mode
		if self.audio==False:
		   self.audio=None
		self.tubemethod='xbmc'
		if self.audio==True:
		  
		   self.skinName='TSRplayer'
		else:
                   self.skinName='TSMplayer'
		self.onPlayStateChanged = [ ]
                try:os.remove("/tmp/index.txt")
                except:pass
                 
                initSubsSettings()
                SubsSupport.__init__(self, embeddedSupport=True, searchSupport=True)
               
		InfoBarPVRState.__init__(self,screen=PVRState)
		self.pvrStateDialog = self.session.instantiateDialog(PVRState)
		self.session = session
		self.plugin_id=plugin_id
		
		try:self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
		except:self.lastservice=None		
		self.plugin_path = PLUGIN_PATH

		self.serviceName=serviceName
		self['plugin_icon'] = Pixmap()
                self.onPlayStateChanged = [ ] 		
                #self['picon'] = Pixmap()		
		
		
		try:os.remove("/tmp/index.txt")
                except:pass	
		self.referer=referer
		print "33",self.referer
		if noexit==True:
		   self['programm'] = Label('May take long time for buffering,please wait..')
		else:
		   if len(playlist)<2:
		     self['programm'] = Label('Please wait..')
		   else:
		     self['programm'] = Label('Please wait,playlist supported')
		self.noexit=noexit
		self.InfoBar_NabDialog = Label('')	
		self['channel_number'] = Label(str(playindex))     

Edited by mfaraj57, 11 November 2014 - 16:58.


Re: How to start MediaPlayer addon with other addon #8 jasko

  • Member
  • 11 posts

0
Neutral

Posted 11 November 2014 - 22:08

@mfaraj57 thanks for help i will try it.

 

BR




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users