DVD Folder Playback using Xamarin.Android
Posted: 16 Jun 2020 18:41
I'm porting a Windows desktop application that allows playback of ripped DVD's stored on a NAS. All of the disks are ripped with menus removed and include only the main title. This allows automatic playback without the need for the user to select anything.
I created a simple proof of concept app--if I save the ripped DVD folder to the tablet's local storage the following code automatically plays the entire movie if I specify the local path to the VIDEO_TS folder:
VLC seems to be able to identify that the VIDEO_TS folder contains .vob files and plays the entire movie; so far so good. But I need to be able to playback movies stored on a NAS. The following code *does not work* when I specify the smb path to the VIDEO_TS folder (I get no errors but the video does not play). It works if the path includes a vob file as noted in the code comments so I know that it isn't failing because of invalid path or authentication issues. Unfortunately, this doesn't do me much good since I need to play the entire movie.
I've tried using the FromType.FromLocation and FromType.FromPath flags but no joy. I can't help but think I'm missing something fundamentally simple. By the way; don't judge me for the movie title. This app is for the special needs school I work at .
I created a simple proof of concept app--if I save the ripped DVD folder to the tablet's local storage the following code automatically plays the entire movie if I specify the local path to the VIDEO_TS folder:
Code: Select all
private void InitVLC( )
{
Core.Initialize();
_libVLC = new LibVLC();
VLCMediaPlayer = new MediaPlayer( _libVLC )
{
EnableHardwareDecoding = true
};
VLCMediaPlayer.EndReached += OnMediaPlayer_EndReached;
VLCVideoView = FindViewById<VideoView>( Resource.Id.vlcVideoView );
VLCVideoView.MediaPlayer = VLCMediaPlayer;
string dvdTsVideoPath = Path.Combine( AppUtilities.GetVideoFolderPath(), "Mulan (1998)" );
dvdTsVideoPath = Path.Combine( dvdTsVideoPath, "VIDEO_TS" );
// The dvdTsVideoPath for the local storage looks like this:
// /storage/emulated/0/Android/data/com.companyname.mymoviespocapp/files/Movies/Mulan (1998)/VIDEO_TS
var media = new Media( _libVLC, dvdTsVideoPath, FromType.FromPath );
bool playing = VLCVideoView.MediaPlayer.Play( media );
}
Code: Select all
private void InitVLC( )
{
Core.Initialize();
_libVLC = new LibVLC();
VLCMediaPlayer = new MediaPlayer( _libVLC )
{
EnableHardwareDecoding = true
};
VLCMediaPlayer.EndReached += OnMediaPlayer_EndReached;
VLCVideoView = FindViewById<VideoView>( Resource.Id.vlcVideoView );
VLCVideoView.MediaPlayer = VLCMediaPlayer;
// This doesn't work...
string dvdTsVideoPath = "smb://user:password@192.168.11.100/Movies1/Mulan (1998)/";
var media = new Media( _libVLC, dvdTsVideoPath, FromType.FromLocation );
// But this does. Unfortunately, I need to play the entire disk so the ability to play a single VOB isn't useful
//string dvdTsVideoPath = "smb://user:password@192.168.11.100/Movies1/Mulan (1998)/VIDEO_TS/VTS_01_1.VOB";
//var media = new Media( _libVLC, dvdTsVideoPath, FromType.FromLocation );
bool playing = VLCVideoView.MediaPlayer.Play( media );
}