kakone / VLC.MediaElement

MediaElement clone powered by VLC
GNU Lesser General Public License v2.1
68 stars 33 forks source link

can we try to make it with MediaPlayerElement as well? #50

Open touseefbsb opened 6 years ago

touseefbsb commented 6 years ago

I knw this question has been asked previously and I already know the answer, that you are actually creating all the features of media element yourself and not using the actual media element I have a few questions regarding that.

  1. Why arent you using the actualy uwp media element?
  2. Can we implement all the features of MediaPlayerElement? just like you implemented features of media element?
  3. Or can we create a custom inherited control from MediaPlayerElement and then somehow use vlc library in it?

The reason I am asking these questions is that is there any possible way that we can use MediaPlayerElement and hence using all its features like MediaPlaybackItem, MediaPlaybackList and all other built in features in uwp. I will be willing to help and achieve this goal if you guide me a little bit how to include vlc library in uwp MediaPlayerElement.

Thanks in advance.

kakone commented 6 years ago
  1. Why arent you using the actualy uwp media element?

Because you can't override the rendering part, you can't set a custom inner mediaplayer.

  1. Can we implement all the features of MediaPlayerElement? just like you implemented features of media element?

You can't implement all the features because you will be restricted by the features available in libVLCX, but you should be able to rewrite a lot of things.

  1. Or can we create a custom inherited control from MediaPlayerElement and then somehow use vlc library in it?

No, you can't inherit from the MediaPlayerElement because you can't set a custom MediaPlayer. You must do a custom control and reimplement all the things you want (without the source code of MediaPlayerElement and MediaPlaybackList to help).

touseefbsb commented 6 years ago

so does that mean we cant even see the code of media element or mediaplayerelement? and you just made a new custom control and rewrite all the features you can think of? Because if we have the actualy c# code of media element and mediaplayerelement, then we can actually rewrite only those parts which use the media player engine and swap that with libvlc engine and other stuff can be mostly be copied over. But we cant see the code right? because I tried to peek the definition and they show us the methods definitions but they are all locked and we cnt see code in them. @kakone

touseefbsb commented 6 years ago

@kakone btw in vs 2017, 15.6 preview 2 they have introduced a new feature in which you can peek definition of compiled libraries and see the actual code with help of a decompiler, not sure whether this feature will also let us see the code for xaml controls. here is the link where they discribe this feature. what do you think will it help us in our particular scenario? https://www.visualstudio.com/en-us/news/releasenotes/vs2017-preview-relnotes#productivity

kakone commented 6 years ago

It will not help because UWP assemblies are compiled to native code, there is no IL code. I don't think that we will see the source code soon. The only thing we have is the XAML style of the MediaTransportControls (in C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.16299.0\Generic\generic.xaml file). We have to rewrite the rest.

touseefbsb commented 6 years ago

@kakone Thanks for the clarification :)

touseefbsb commented 6 years ago

@kakone another question regarding the generic.xaml, if I use this file to take out styles, as it is generic.xaml file of Fall creators update, so will that style work fine on previous version as well? considering my app minimum target is creators update?

kakone commented 6 years ago

Yes, it will work on previous versions.

kakone commented 6 years ago

According to you, what really useful features available in the MediaPlayerElement control are missing in the VLC.MediaElement control ? I think we can easily rewrite a VLC.MediaPlayerElement in the library. The two controls will use the same MediaTransportControls.

touseefbsb commented 6 years ago

@kakone well if you are willing to do that then I can give you a complete and detailed list of features tht why mediaplayerelement is a lot better than media element, but for now some of the main features are following.

MediaPlaybackItem :

MediaSource is usually used in mediaelement but mediaplaybackitem is an extension of mediaSource which includes audio tracks, video tracks, and TimedMetaDataTracks ( contains embeeded subtitles in the video file ).

MediaPlaybakcList:

This list is optimized and specially designed to give features of playlists in the app, and it used a list of MediaPlaybackItems and then there are some methods to shuffle, and do other stuff which typically a playlist does.

SMTC:

Mediaplayerelement is automatically synced with system media transport controls. we only have to set the thumbnail and file name with them but the pause/play and next/previous buttons of smtc automatically work without any effort.

MediaPlayer

SetMediaPlayer() is a method on mediaplayerelement, with this we can set a mediaplayer object to it and control all media functionalities with mediaplayerelement.mediaplayer object, a big advantage of this feature is that we can do a lot of custom logic with respect to the app, including a use case in which we can have a global static media player object and assign it to any mediaplayerelement on any page in the app and that media player will retain the file playing and its position and other stuff too, I havent tried to implement this feature yet, but will probably do once I figure out these basic problems.

There are many style changes and improved UI in mediaplayerelement as well which will only be known once we explore its style properly.

touseefbsb commented 6 years ago

@kakone I asked the question about generic xaml styles bcz, there is some stuff in newer SDKs like reveal style on transportcontrol buttons and acrylic background etc. so if I use the latest style, that wont cause a problem in older versions? I mean those styles are automatically responsive to version numbers and we dont have to care about that?

kakone commented 6 years ago

Yes, if there are some styles that doesn't exist in previous versions, there will be a problem. You can't use runtime API checks to determine the presence of XAML resources. So, you must only use resource keys that are available in the minimum version that your app supports or a XAMLParseException will cause your app to crash at runtime.

I'm currently adding the latest version of the MediaTransportControls style with a new RepeatButton.

touseefbsb commented 6 years ago

@kakone Yeah that is wht I was thinking too. Also what do you think about the mediaplayerelement features I told u ?

kakone commented 6 years ago

I'm looking the MediaPlayerElement control. I think I will propose a custom VLC.MediaPlayerElement, the features you proposed should be not so difficult to implement.

touseefbsb commented 6 years ago

@kakone Thats great, and if you need any kind of suggestions or help in that project or detailed docs of any component related to these features I'll be happy to help you in all that . for now following are some useful docs regarding some important objects.

Playing with MediaPlayBackItem : https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/media-playback-with-mediasource

MediaSource: https://docs.microsoft.com/en-us/uwp/api/windows.media.core.mediasource

MediaPlayBackItem: https://docs.microsoft.com/en-us/uwp/api/Windows.Media.Playback.MediaPlaybackItem

MediaPlayerElement: https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.MediaPlayerElement

MediaPlayerPresenter: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.mediaplayerpresenter

MediaPlayer: https://docs.microsoft.com/en-us/uwp/api/windows.media.playback.mediaplayer

MediaPlaybackList: https://docs.microsoft.com/en-us/uwp/api/Windows.Media.Playback.MediaPlaybackList

P.S : I will suggest you to make the minim project target of VLC.MediaPlayerElement as "Creators Update" Because conditional xaml was introduced in this SDK update and with that xaml becomes very easy and responsive to sdks and we dont have to go through trouble of setting xaml from code behind by checking the API contracts dynamically, it will be beneficial in implementing some features and will be benficial in maintaining the project in the long run, and eventually all devices will update the windows 10 version anyways so very soon anniversay update will be supported by only a few devices.

touseefbsb commented 6 years ago

@kakone any progress on this? :)

kakone commented 6 years ago

No, unfortunately, I didn't have time to do it until now.

touseefbsb commented 6 years ago

@kakone Ok please let me know on this issue when you have time so we can discuss this ( if needs be ) and move this forward thanks