locked
Exception when opening a video file

    Question

  •  

    I am doing this,

    return concurrency::create_task(file->OpenAsync(FileAccessMode::ReadWrite)).then([=](Streams::IRandomAccessStream^ strm)
    
    {
    
    this->videoMediaElement->Stop(); 
    
    
    this->videoMediaElement->SetSource(strm, file->ContentType);
    
    
    
    this->videoMediaElement->SetValue(FileNameProperty, file->DisplayName);
    
    
    this->videoMediaElement->SetValue(FilePathProperty, file->Path);
    
    
    this->videoMediaElement->Width = this->Frame->Width;
    
    
    this->videoMediaElement->Height =this->Frame->Height;  	
    
    });
    
    }
    
    Exception: The exception is not in my code..

    msvcr110d.dll!Concurrency::details::_ReportUnobservedException() Line 2455 C++
      ViPic.exe!Concurrency::details::_ExceptionHolder::~_ExceptionHolder() Line 882 C++
      ViPic.exe!Concurrency::details::_ExceptionHolder::`scalar deleting destructor'(unsigned int) C++
      ViPic.exe!std::_Ref_count_obj<Concurrency::details::_ExceptionHolder>::_Destroy() Line 885 C++
      ViPic.exe!std::_Ref_count_base::_Decref() Line 120 C++
      ViPic.exe!std::_Ptr_base<Concurrency::details::_ExceptionHolder>::_Decref() Line 347 C++
      ViPic.exe!std::shared_ptr<Concurrency::details::_ExceptionHolder>::~shared_ptr<Concurrency::details::_ExceptionHolder>() Line 624 C++
      ViPic.exe!Concurrency::details::_Task_impl_base::~_Task_impl_base() Line 1294 C++
      ViPic.exe!Concurrency::details::_Task_impl<unsigned char>::~_Task_impl<unsigned char>() Line 1972 C++
      ViPic.exe!Concurrency::details::_Task_impl<unsigned char>::`scalar deleting destructor'(unsigned int) C++
      ViPic.exe!std::_Ref_count_obj<Concurrency::details::_Task_impl<unsigned char> >::_Destroy() Line 884 C++
      ViPic.exe!std::_Ref_count_base::_Decref() Line 120 C++
      ViPic.exe!std::_Ptr_base<Concurrency::details::_Task_impl_base>::_Decref() Line 347 C++
      ViPic.exe!std::shared_ptr<Concurrency::details::_Task_impl_base>::~shared_ptr<Concurrency::details::_Task_impl_base>() Line 624 C++
      ViPic.exe!Concurrency::details::_Task_impl_base::_RunContinuation(Concurrency::details::_ContinuationTaskHandleBase * _PTaskHandle) Line 1627 C++
      ViPic.exe!Concurrency::details::_Task_impl_base::_RunTaskContinuations() Line 1781 C++
      ViPic.exe!Concurrency::details::_Task_impl<Windows::Storage::Streams::IRandomAccessStream ^>::_FinalizeAndRunContinuations(Windows::Storage::Streams::IRandomAccessStream ^ _Result) Line 2088 C++
      ViPic.exe!<lambda_c89d7c6b5ff3023091ef6b696e4eb185>::operator()(Windows::Foundation::IAsyncOperation<Windows::Storage::Streams::IRandomAccessStream ^> ^ _Operation, Windows::Foundation::AsyncStatus _Status) Line 1856 C++
      ViPic.exe!Platform::Details::__abi_FunctorCapture2<<lambda_c89d7c6b5ff3023091ef6b696e4eb185>,void,Windows::Foundation::IAsyncOperation<Windows::Storage::Streams::IRandomAccessStream ^> ^,enum Windows::Foundation::AsyncStatus>::Invoke(Windows::Foundation::IAsyncOperation<Windows::Storage::Streams::IRandomAccessStream ^> ^ __arg0, Windows::Foundation::AsyncStatus __arg1) Line 864 C++
      ViPic.exe!Windows::Foundation::AsyncOperationCompletedHandler<Windows::Storage::Streams::IRandomAccessStream ^>::Invoke(Windows::Foundation::IAsyncOperation<Windows::Storage::Streams::IRandomAccessStream ^> ^ __param0, Windows::Foundation::AsyncStatus __param1) C++
    ViPic.exe!?__abi_Windows_Foundation_?$AsyncOperationCompletedHandler@P$AAUIRandomAccessStream@Streams@Storage@Windows@@___abi_IDelegate____abi_Invoke@?Q__abi_IDelegate@?$AsyncOperationCompletedHandler@P$AAUIRandomAccessStream@Streams@Storage@Windows@@@Foundation@Windows@@234@U$AAGJP$AAU?$IAsyncOperation@P$AAUIRandomAccessStream@Streams@Storage@Windows@@@34@W4AsyncStatus@34@@Z(Windows::Foundation::IAsyncOperation<Windows::Storage::Streams::IRandomAccessStream ^> ^ __param0, Windows::Foundation::AsyncStatus __param1) C++

      
    Thursday, August 2, 2012 7:14 PM

All replies

  • Hello,

    How about this sample codes work on your media file.
    http://code.msdn.microsoft.com/windowsapps/Media-PlayTo-Sample-fedcb0f9/

    Or you can post more codes here, so that we can analyze this problem.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, August 6, 2012 7:33 AM
  • I have similar problem. The problem is in

    this->videoMediaElement->SetSource(strm, file->ContentType);

    The old strm in Source should had been closed.

    In my Windows 7 code there is no problem by using OpenFileDialog and open file in sync.

    Where is the Sync Open File instead of OpenASync() in Windows 8 Metro? I need to open file one after another.


    Charlie Chang L

    Monday, August 6, 2012 7:40 PM
  • Hello,

    Would you please provide us the whole codes to reproduce this issue,

    You can upload your project to skydriver
    http://skydrive.live.com/

    It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, August 9, 2012 5:47 AM