private void PrepareResources()
        {
            // Get the media filename
            m_TemplateFile = m_Template.TemplateDataSet.GetTemplateDataSetItemAsFile(MediaFileKey);
            if (m_TemplateFile != null)
            {
                if (m_TemplateFile.FileName != m_PlayingFilename)
                {
                    //We don't have enought data in the datset yet.
                    //It will soon be updated in TemplateDataSet_TemplateDataSetChanged event
                    m_TemplateFile.TemplateFileDeleted += m_TemplateFile_TemplateFileDeleted;

                    if (m_TemplateFile.IsAvailable)
                    {
                        SetMedia();
                    }
                    else
                    {
                        m_Template.Debug(API.DebugLevel.High, API.DebugCategory.Error, "File " + m_TemplateFile.Name + " not present, downloading on demand as file " + m_TemplateFile.FileName);

                        m_Template.SetState("Prepare", API.State.Initializing, "Downloading file");

                        m_TemplateFile.DownloadFileFinished += m_TemplateFile_DownloadFileFinished;
                        m_TemplateFile.DownloadFileProgress += m_TemplateFile_DownloadFileProgress;
                        m_TemplateFile.DownloadAsync();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void PrepareResources()
        {
            if (!m_Prepared)
            {
                // Get the media filename
                m_TemplateFile = m_Template.TemplateDataSet.GetTemplateDataSetItemAsFile(MediaFileKey);
                if (m_TemplateFile != null)
                {
                    //We don't have enought data in the datset yet.
                    //It will soon be updated in TemplateDataSet_TemplateDataSetChanged event

                    if (!m_TemplateFile.IsAvailable)
                    {
                        m_Template.Debug(API.DebugLevel.High, API.DebugCategory.Error, "File " + m_TemplateFile.Name + " not present, downloading on demand as file " + m_TemplateFile.FileName);
                        m_TemplateFile.Download();
                    }

                    if (!string.IsNullOrEmpty(m_TemplateFile.FileName))
                    {
                        Console.WriteLine("Prepare");

                        m_Prepared = true;

                        m_Template.SetState(API.State.Initializing, "Prepared");

                        m_Template.Debug(API.DebugLevel.Low, API.DebugCategory.Information, "Prepared file " + m_TemplateFile.Name);
                    }
                    else
                    {
                        m_Prepared = false;

                        m_Template.SetState(API.State.Initializing, "Not yet ready to prepared");

                        m_Template.Debug(API.DebugLevel.High, API.DebugCategory.Error, "File " + m_TemplateFile.Name + " was not found at " + m_TemplateFile.FileName + " on prepare");
                    }
                }
                else
                {
                    m_Prepared = false;
                }
            }
        }
Exemplo n.º 3
0
        private void CheckDataSetChange(API.ITemplateDataSet templateDataSet)
        {
            API.ITemplateFile templateFile = templateDataSet.GetTemplateDataSetItemAsFile(MediaFileKey);
            if (templateFile != null)
            {
                if (m_TemplateFile == null || !m_TemplateFile.FileName.Equals(templateFile.FileName, StringComparison.OrdinalIgnoreCase))
                {
                    //Media filename has changed
                    m_Template.Debug(API.DebugLevel.Low, API.DebugCategory.Information, "Media file changed to " + templateFile.FileName);

                    if (m_PlayRequested)
                    {
                        m_Template.Debug(API.DebugLevel.Low, API.DebugCategory.Information, "Restarting media");

                        //Restart play of new file
                        StopPlay();
                        ReleaseResources();
                        PrepareResources();
                        StartPlay(null, 0, 0);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void PrepareResources()
        {
            if (!m_Prepared)
            {
                // Get the media filename
                m_TemplateFile = m_Template.TemplateDataSet.GetTemplateDataSetItemAsFile(MediaFileKey);
                if (m_TemplateFile != null)
                {
                    //We don't have enought data in the datset yet.
                    //It will soon be updated in TemplateDataSet_TemplateDataSetChanged event

                    if (!m_TemplateFile.IsAvailable)
                    {
                        m_Template.Debug(API.DebugLevel.High, API.DebugCategory.Error, "File " + m_TemplateFile.Name + " not present, downloading on demand as file " + m_TemplateFile.FileName);
                        m_TemplateFile.Download();
                    }

                    if (!string.IsNullOrEmpty(m_TemplateFile.FileName))
                    {
                        Console.WriteLine("Prepare");

                        m_Prepared = true;

                        m_Template.SetState(API.State.Initializing, "Prepared");

                        m_Template.Debug(API.DebugLevel.Low, API.DebugCategory.Information, "Prepared file " + m_TemplateFile.Name);
                    }
                    else
                    {
                        m_Prepared = false;

                        m_Template.SetState(API.State.Initializing, "Not yet ready to prepared");

                        m_Template.Debug(API.DebugLevel.High, API.DebugCategory.Error, "File " + m_TemplateFile.Name + " was not found at " + m_TemplateFile.FileName + " on prepare");
                    }
                }
                else
                {
                    m_Prepared = false;
                }
            }
        }
Exemplo n.º 5
0
        private void PrepareResources()
        {
            // Get the media filename
            m_TemplateFile = m_Template.TemplateDataSet.GetTemplateDataSetItemAsFile(MediaFileKey);
            if (m_TemplateFile != null)
            {
                if (m_TemplateFile.FileName != m_PlayingFilename)
                {
                    //We don't have enought data in the datset yet.
                    //It will soon be updated in TemplateDataSet_TemplateDataSetChanged event
                    m_TemplateFile.TemplateFileDeleted += m_TemplateFile_TemplateFileDeleted;

                    if (m_TemplateFile.IsAvailable)
                    {
                        SetMedia();
                    }
                    else
                    {
                        m_Template.Debug(API.DebugLevel.High, API.DebugCategory.Error, "File " + m_TemplateFile.Name + " not present, downloading on demand as file " + m_TemplateFile.FileName);

                        m_Template.SetState("Prepare", API.State.Initializing, "Downloading file");

                        m_TemplateFile.DownloadFileFinished += m_TemplateFile_DownloadFileFinished;
                        m_TemplateFile.DownloadFileProgress += m_TemplateFile_DownloadFileProgress;
                        m_TemplateFile.DownloadAsync();
                    }
                }
            }
        }