This commit is contained in:
yumoqing 2020-08-08 16:57:55 +08:00
parent f0eb108afd
commit e1d8053389
2 changed files with 14 additions and 3 deletions

View File

@ -29,6 +29,7 @@ from .vplayer import VPlayer
from .form import InputBox, Form, StrSearchForm from .form import InputBox, Form, StrSearchForm
from .boxViewer import BoxViewer from .boxViewer import BoxViewer
from .tree import Tree, TextTree from .tree import Tree, TextTree
from .newvideo import Video
def showError(e): def showError(e):
print('error',e) print('error',e)

View File

@ -1,7 +1,10 @@
from kivy.uix.video import Video from kivy.uix.video import Video
from kivy.logger import Logger from kivy.logger import Logger
from kivy.core.window improt Window from kivy.core.window import Window
from kivy.utils import platform from kivy.utils import platform
from kivy.factory import Factory
from kivy.properties import BooleanProperty
from ffpyplayer.tools import set_log_callback from ffpyplayer.tools import set_log_callback
desktopOSs=[ desktopOSs=[
"win", "win",
@ -22,17 +25,24 @@ class NewVideo(Video):
_fullscreen_state = False _fullscreen_state = False
def __init__(self,**kw): def __init__(self,**kw):
super(NewVideo, self).__init__(**kw)
Window.allow_screensaver = False Window.allow_screensaver = False
set_log_callback(self.ffplayerLog) set_log_callback(self.ffplayerLog)
if hasattr(self._video, '_ffplayer'): if hasattr(self._video, '_ffplayer'):
self.ffplayer = self._video._ffplayer self.ffplayer = self._video._ffplayer
Window.bind(on_rotate=self.ctrl_fullscreen)
def ctrl_fullscreen(self,*args):
if Window.width > Window.height:
self.fullscreen = True
else:
self.fullscreen = False
def ffplayerLog(self, msg, level): def ffplayerLog(self, msg, level):
msg = msg.strip() msg = msg.strip()
if msg: if msg:
logger_func[level]('yffpyplayer: {}'.format(msg)) logger_func[level]('yffpyplayer: {}'.format(msg))
if level == 'error' and self.source in msg:
self.dispatch('on_source_error',self,self.source)
def audioswitch(self,btn=None): def audioswitch(self,btn=None):
x = self._video._ffplayer.request_channel('audio') x = self._video._ffplayer.request_channel('audio')