Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, February 25, 2009 6:28:22 PM(UTC)
jashureddy

Groups: Registered
Posts: 18


Hiiiiiiiiiiiii

 
i am unable to open  divx, few flv files,flash object  files also in the following code can u help me ot

one more thing is my track bar is not moving along with the video .....can u suggest what to do?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using LTMMLib;
using Leadtools;
using Leadtools.Codecs;

namespace VideoLoad
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        double FrameRate;
       
        private void button1_Click(object sender, EventArgs e)
        {
            //open a new media file through dialog and play it
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Video Files (*.avi; *.mpg; *.mpeg; *.ogg; *.qt; *.mov; *.m1v; *.asf; *.wmv; video_ts.ifo;*.MP4)|*.avi; *.mpg; *.mpeg; *.ogg; *.qt; *.mov; *.m1v; *.asf;*.flv;*.divx; *.wmv; video_ts.ifo;*.MP4|" +
                         "Windows Media Files (*.asf; *.wma;*.flv;*.wmv)|*.asf; *.wma; *.flv;*.divx;*.wmv|" +
                         "DVD Files (video_ts.ifo;.divx)|video_ts.ifo;.divx|" +
                         "All Files (*.*)|*.*";

            if (ofd.ShowDialog() == DialogResult.OK)
            {             
                try
                {
                    //get frame rate for new file, will need it later
                    LTMMLib.ltmmMediaInfoClass info = new LTMMLib.ltmmMediaInfoClass();
                    info.sourcefile = ofd.FileName;

                    //look for video stream so we can get frame rate
                    for (int i = 0; i < info.OutputStreams; i++)
                    {
                        info.CurrentStream = i;
                        if (info.StreamTypeName.ToLower() == "video")
                        {
                            FrameRate = info.VideoFrameRate;
                            break;
                        }
                    }
                    axltmmPlayCtrl1.Stop();
                    axltmmPlayCtrl1.ResetSource();
                    Application.DoEvents();
                    axltmmPlayCtrl1.sourcefile = ofd.FileName;                          
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }

        private void trkPosition_Scroll(object sender, EventArgs e)
        {
            try
            {
                //update tracking position from slider
                axltmmPlayCtrl1.CurrentTrackingPosition = trkPosition.Value;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void _play_Click(object sender, EventArgs e)
        {
            try
            {
                //play file
                axltmmPlayCtrl1.Run();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void _pause_Click(object sender, EventArgs e)
        {
            //pause the player
            try
            {
                axltmmPlayCtrl1.Pause();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void _stop_Click(object sender, EventArgs e)
        {
            try
            {
                //stop file
                axltmmPlayCtrl1.Stop();
                Application.DoEvents();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }     

      
    }
}
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, February 25, 2009 10:58:25 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

If you try to open the same video files (Divx, flv files, etc.) using any of the LEADTOOLS player demos that ship with the SDK, do you face the same problem?

About moving the track bar with the video, you can handle the ltmmPlayCtrl_TrackingPositionChanged Event and set the trkPosition.Value to the Position that you get from the event:
+---------+
Private Sub ltmmPlay_TrackingPositionChanged(ByVal pos As Long)
trkPosition.Value = pos
End Sub
+---------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.173 seconds.