Skip to content

Commit

Permalink
Merge pull request #23 from infoMantisGmbH/bspinner/update_mvx_4
Browse files Browse the repository at this point in the history
Update to Mvx4 stable and fixed Mvx sample
  • Loading branch information
martijn00 committed Mar 3, 2016
2 parents d3990e1 + 4b3693e commit 4fe8b23
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 103 deletions.
24 changes: 13 additions & 11 deletions Samples/MvvmCross/ExoPlayer.Core/ExoPlayer.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
Expand All @@ -51,20 +52,21 @@
</Target>
-->
<ItemGroup>
<Reference Include="MvvmCross.Platform">
<HintPath>..\packages\MvvmCross.Platform.4.0.0-beta8\lib\portable-net45+win+wpa81+wp80\MvvmCross.Platform.dll</HintPath>
<Reference Include="MvvmCross.Binding, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Binding.4.0.0\lib\portable-net45+win+wpa81+wp80\MvvmCross.Binding.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Localization">
<HintPath>..\packages\MvvmCross.Platform.4.0.0-beta8\lib\portable-net45+win+wpa81+wp80\MvvmCross.Localization.dll</HintPath>
<Reference Include="MvvmCross.Core, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Core.4.0.0\lib\portable-net45+win+wpa81+wp80\MvvmCross.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Core">
<HintPath>..\packages\MvvmCross.Core.4.0.0-beta8\lib\portable-net45+win+wpa81+wp80\MvvmCross.Core.dll</HintPath>
<Reference Include="MvvmCross.Localization, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Binding.4.0.0\lib\portable-net45+win+wpa81+wp80\MvvmCross.Localization.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Binding">
<HintPath>..\packages\MvvmCross.Binding.4.0.0-beta8\lib\portable-net45+win+wpa81+wp80\MvvmCross.Binding.dll</HintPath>
<Reference Include="MvvmCross.Platform, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Platform.4.0.0\lib\portable-net45+win+wpa81+wp80\MvvmCross.Platform.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions Samples/MvvmCross/ExoPlayer.Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MvvmCross" version="4.0.0-beta8" targetFramework="portable-net45+win+wpa81+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
<package id="MvvmCross.Binding" version="4.0.0-beta8" targetFramework="portable-net45+win+wpa81+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
<package id="MvvmCross.Core" version="4.0.0-beta8" targetFramework="portable-net45+win+wpa81+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
<package id="MvvmCross.Platform" version="4.0.0-beta8" targetFramework="portable-net45+win+wpa81+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
<package id="MvvmCross" version="4.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="MvvmCross.Binding" version="4.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="MvvmCross.Core" version="4.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="MvvmCross.Platform" version="4.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
</packages>
56 changes: 32 additions & 24 deletions Samples/MvvmCross/ExoPlayer.Droid/ExoPlayer.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,45 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ExoPlayer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xam.Plugins.Android.ExoPlayer.1.5.6\lib\MonoAndroid\ExoPlayer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Android" />
<Reference Include="Mono.Android.Export" />
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="ExoPlayer">
<HintPath>..\packages\Xam.Plugins.Android.ExoPlayer.1.5.3\lib\MonoAndroid\ExoPlayer.dll</HintPath>
</Reference>
<Reference Include="MvvmCross.Platform.Droid">
<HintPath>..\packages\MvvmCross.Platform.4.0.0-beta8\lib\MonoAndroid\MvvmCross.Platform.Droid.dll</HintPath>
<Reference Include="MvvmCross.Binding, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Binding.4.0.0\lib\MonoAndroid\MvvmCross.Binding.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Platform">
<HintPath>..\packages\MvvmCross.Platform.4.0.0-beta8\lib\MonoAndroid\MvvmCross.Platform.dll</HintPath>
<Reference Include="MvvmCross.Binding.Droid, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Binding.4.0.0\lib\MonoAndroid\MvvmCross.Binding.Droid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Localization">
<HintPath>..\packages\MvvmCross.Platform.4.0.0-beta8\lib\MonoAndroid\MvvmCross.Localization.dll</HintPath>
<Reference Include="MvvmCross.Core, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Core.4.0.0\lib\MonoAndroid\MvvmCross.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Droid">
<HintPath>..\packages\MvvmCross.Core.4.0.0-beta8\lib\MonoAndroid\MvvmCross.Droid.dll</HintPath>
<Reference Include="MvvmCross.Droid, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Core.4.0.0\lib\MonoAndroid\MvvmCross.Droid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Core">
<HintPath>..\packages\MvvmCross.Core.4.0.0-beta8\lib\MonoAndroid\MvvmCross.Core.dll</HintPath>
<Reference Include="MvvmCross.Localization, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Binding.4.0.0\lib\MonoAndroid\MvvmCross.Localization.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Binding.Droid">
<HintPath>..\packages\MvvmCross.Binding.4.0.0-beta8\lib\MonoAndroid\MvvmCross.Binding.Droid.dll</HintPath>
<Reference Include="MvvmCross.Platform, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Platform.4.0.0\lib\MonoAndroid\MvvmCross.Platform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Binding">
<HintPath>..\packages\MvvmCross.Binding.4.0.0-beta8\lib\MonoAndroid\MvvmCross.Binding.dll</HintPath>
<Reference Include="MvvmCross.Platform.Droid, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.Platform.4.0.0\lib\MonoAndroid\MvvmCross.Platform.Droid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Player\MvxExtractorRendererBuilder.cs" />
Expand All @@ -77,9 +85,6 @@
<ItemGroup>
<AndroidResource Include="Resources\layout\activity_videoplayer.axml" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand All @@ -94,4 +99,7 @@
<Name>ExoPlayer.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
7 changes: 3 additions & 4 deletions Samples/MvvmCross/ExoPlayer.Droid/MvxVideoPlayerActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
using MvvmCross.ExoPlayer.ViewModels;
using Exception = Java.Lang.Exception;
using Uri = Android.Net.Uri;
using MvvmCross.ExoPlayer.ViewModels;
using MvvmCross.Droid.Views;
using MvvmCross.Platform.Platform;
using MvvmCross.Binding.BindingContext;
Expand Down Expand Up @@ -338,7 +337,7 @@ public void OnAudioCapabilitiesChanged(AudioCapabilities audioCapabilities)

private MvxVideoPlayer.IRendererBuilder GetRendererBuilder()
{
var userAgent = Util.GetUserAgent(this, "ExoPlayerDemo");
var userAgent = ExoPlayerUtil.GetUserAgent(this, "ExoPlayerDemo");
var url = Item.Url;
switch (Item.Type)
{
Expand Down Expand Up @@ -432,7 +431,7 @@ public void OnError(Exception e)
{
// TODO
// Special case DRM failures.
var msg = Util.SdkInt < 18
var msg = ExoPlayerUtil.SdkInt < 18
? "drm_error_not_supported"
: exception.Reason == UnsupportedDrmException.ReasonUnsupportedScheme
? "drm_error_unsupported_scheme"
Expand Down Expand Up @@ -549,7 +548,7 @@ private void ConfigureSubtitleView()
{
CaptionStyleCompat style;
float fontScale;
if (Util.SdkInt >= 19)
if (ExoPlayerUtil.SdkInt >= 19)
{
style = GetUserCaptionStyleV19();
fontScale = GetUserCaptionFontScaleV19();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
using Android.Content;
using Android.Media;
using Android.Net;
using Android.Net.Rtp;
using Android.Runtime;
using Com.Google.Android.Exoplayer;
using Com.Google.Android.Exoplayer.Audio;
using Com.Google.Android.Exoplayer.Drm;
using Com.Google.Android.Exoplayer.Extractor;
using Com.Google.Android.Exoplayer.Text;
using Com.Google.Android.Exoplayer.Upstream;
Expand Down Expand Up @@ -50,16 +52,17 @@ public void BuildRenderers(MvxVideoPlayer player)
{
var allocator = new DefaultAllocator(BufferSegmentSize);


// Build the video and audio renderers.
var bandwidthMeter = new DefaultBandwidthMeter(player.MainHandler, null);
var dataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
var sampleSource = new ExtractorSampleSource(_uri, dataSource, allocator,
BufferSegmentCount*BufferSegmentSize);
var videoRenderer = new MediaCodecVideoTrackRenderer(_context,
sampleSource, (int) VideoScalingMode.ScaleToFit, 5000, player.MainHandler,
sampleSource, MediaCodecSelector.Default, (int) VideoScalingMode.ScaleToFit, 5000, player.MainHandler,
player, 50);
var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
null, true, player.MainHandler, player, AudioCapabilities.GetCapabilities(_context));
var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
MediaCodecSelector.Default, null, true, player.MainHandler, player, AudioCapabilities.GetCapabilities(_context), (int) Stream.Music);
var textRenderer = new TextTrackRenderer(sampleSource, player,
player.MainHandler.Looper);

Expand Down
66 changes: 33 additions & 33 deletions Samples/MvvmCross/ExoPlayer.Droid/Player/MvxHlsRendererBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
* limitations under the License.
*/

using System.Linq;
using Android.Content;
using Android.Media;
using Android.Runtime;
using Com.Google.Android.Exoplayer;
using Com.Google.Android.Exoplayer.Audio;
using Com.Google.Android.Exoplayer.Chunk;
using Com.Google.Android.Exoplayer.Hls;
using Com.Google.Android.Exoplayer.Text.Eia608;
using Com.Google.Android.Exoplayer.Upstream;
Expand Down Expand Up @@ -119,37 +117,39 @@ public void OnSingleManifest(Object obj)
var mainHandler = _player.MainHandler;
var loadControl = new DefaultLoadControl(new DefaultAllocator(BufferSegmentSize));
var bandwidthMeter = new DefaultBandwidthMeter();

int[] variantIndices = null;
if (manifest is HlsMasterPlaylist)
{
var masterPlaylist = (HlsMasterPlaylist) manifest;
try
{
variantIndices = VideoFormatSelectorUtil.SelectVideoFormatsForDefaultDisplay(
_context, masterPlaylist.Variants.Cast<IFormatWrapper>().ToList(), null, false);
}
catch (MediaCodecUtil.DecoderQueryException e)
{
_player.OnRenderersError(e);
return;
}
if (variantIndices.Length == 0)
{
_player.OnRenderersError(new IllegalStateException($"No variants selected. Possible reason: your video's resolution could be too high. This device maximum H264 framesize is {MediaCodecUtil.MaxH264DecodableFrameSize()}."));
return;
}
}

var dataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
var chunkSource = new HlsChunkSource(dataSource, _url, manifest, bandwidthMeter,
variantIndices, HlsChunkSource.AdaptiveModeSplice);
var sampleSource = new HlsSampleSource(chunkSource, loadControl,
BufferSegments*BufferSegmentSize, mainHandler, _player, MvxVideoPlayer.TypeVideo);
var videoRenderer = new MediaCodecVideoTrackRenderer(_context,
sampleSource, (int) VideoScalingMode.ScaleToFit, 5000, mainHandler, _player, 50);
var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
null, true, _player.MainHandler, _player, AudioCapabilities.GetCapabilities(_context));
var timestampAdjusterProvider = new PtsTimestampAdjusterProvider();

var dataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
var chunkSource = new HlsChunkSource(true
, dataSource
, _url
, manifest
, DefaultHlsTrackSelector.NewDefaultInstance(_context)
, bandwidthMeter
, timestampAdjusterProvider
, HlsChunkSource.AdaptiveModeSplice);
var sampleSource = new HlsSampleSource(chunkSource
, loadControl
, BufferSegments*BufferSegmentSize
, mainHandler
, _player
, MvxVideoPlayer.TypeVideo);
var videoRenderer = new MediaCodecVideoTrackRenderer(_context
, sampleSource
, MediaCodecSelector.Default
, (int) VideoScalingMode.ScaleToFit
, 5000
, mainHandler
, _player
, 50);
var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource
, MediaCodecSelector.Default
, null
, true
, _player.MainHandler
, _player
, AudioCapabilities.GetCapabilities(_context)
, (int) Stream.Music);
// TODO: The Id3Parser is currently not part of the binding
//MetadataTrackRenderer id3Renderer = new MetadataTrackRenderer(sampleSource, new Id3Parser(), player, mainHandler.getLooper());
var closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, _player,
Expand Down
11 changes: 8 additions & 3 deletions Samples/MvvmCross/ExoPlayer.Droid/Player/MvxVideoPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,12 @@ private void PushSurface(bool blockForSurfacePush)

public void OnAudioTrackUnderrun (int p0, long p1, long p2)
{
throw new System.NotImplementedException ();
}
}
// Do nothing.
}

public void OnAvailableRangeChanged(int p0, ITimeRange p1)
{
// Do nothing.
}
}
}
17 changes: 6 additions & 11 deletions Samples/MvvmCross/ExoPlayer.Droid/Resources/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Samples/MvvmCross/ExoPlayer.Droid/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MvvmCross" version="4.0.0-beta8" targetFramework="MonoAndroid60" />
<package id="MvvmCross.Binding" version="4.0.0-beta8" targetFramework="MonoAndroid60" />
<package id="MvvmCross.Core" version="4.0.0-beta8" targetFramework="MonoAndroid60" />
<package id="MvvmCross.Platform" version="4.0.0-beta8" targetFramework="MonoAndroid60" />
<package id="Xam.Plugins.Android.ExoPlayer" version="1.5.3" targetFramework="MonoAndroid60" />
<package id="MvvmCross" version="4.0.0" targetFramework="monoandroid60" />
<package id="MvvmCross.Binding" version="4.0.0" targetFramework="monoandroid60" />
<package id="MvvmCross.Core" version="4.0.0" targetFramework="monoandroid60" />
<package id="MvvmCross.Platform" version="4.0.0" targetFramework="monoandroid60" />
<package id="Xam.Plugins.Android.ExoPlayer" version="1.5.6" targetFramework="monoandroid60" />
</packages>
Loading

0 comments on commit 4fe8b23

Please sign in to comment.