This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AndroidJavaObject localMediaPlayer = null; | |
using (AndroidJavaClass javaUnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) | |
{ | |
using (currentActivity = javaUnityPlayer.GetStatic<AndroidJavaObject>("currentActivity")) | |
{ | |
localMediaPlayer = new AndroidJavaObject("my/plugin/vr/ExoPlayerBridge", currentActivity); | |
if (localMediaPlayer != null) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can't use AndroidJavaObject.Call() with a jobject, must use low level interface | |
IntPtr setSimplePlayerID = AndroidJNI.GetMethodID(localMediaPlayer.GetRawClass(), "setSurface", "(Landroid/view/Surface;)V"); | |
jvalue[] parms = new jvalue[1]; | |
parms[0] = new jvalue(); | |
parms[0].l = _androidSurface; // Android Surface reference as an IntPtr | |
AndroidJNI.CallVoidMethod(localMediaPlayer.GetRawObject(), setSimplePlayerID, parms); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add similar movies to the container | |
movies.filter { it.hasTrailers }.forEach { | |
nextTrailersContainer += NextTrailerView(this).apply { | |
setCallback(this@CinemurPlayerActivity) | |
setTrailer(it) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface DataSource extends DataReader { | |
interface Factory { | |
DataSource createDataSource(); | |
} | |
void addTransferListener(TransferListener transferListener); | |
long open(DataSpec dataSpec) throws IOException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SmbDataSourceFactory(private val fileUrl: String) : DataSource.Factory { | |
override fun createDataSource(): DataSource { | |
val dataSpec = DataSpec(Uri.parse(fileUrl)) | |
return SmbDataSource(dataSpec) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SmbDataSource(private val dataSpec: DataSpec) : BaseDataSource(/* isNetwork= */ true) { | |
private val userName: String | |
private val password: String | |
private val hostName: String | |
private val shareName: String | |
private val path: String | |
init { | |
// Get user credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SmbDataSource(private val dataSpec: DataSpec) : BaseDataSource(/* isNetwork= */ true) { | |
private var smbClient: SMBClient? = null | |
private var inputStream: InputStream? = null | |
private var bytesRemaining: Long | |
private var opened: Boolean | |
@Throws(IOException::class) | |
override fun open(): Long { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SmbDataSource(private val dataSpec: DataSpec) : BaseDataSource(/* isNetwork= */ true) { | |
private var bytesRemaining: Long | |
@Throws(IOException::class) | |
override fun read(buffer: ByteArray, offset: Int, readLength) { | |
if (readLength == 0) { | |
return 0 | |
} else if (bytesRemaining == 0) { | |
return C.RESULT_END_OF_INPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun buildMediaSource(uri: Uri, drmSessionManager: DrmSessionManager<FrameworkMediaCrypto>): MediaSource? { | |
when (val type = PlayerUtils.inferContentType(videoUrl)) { | |
... | |
C.TYPE_OTHER -> { | |
return if (videoUrl.isSmb()) { | |
ProgressiveMediaSource.Factory(SmbDataSourceFactory(videoUrl)) | |
.setDrmSessionManager(drmSessionManager) | |
.createMediaSource(uri) | |
} else { | |
ProgressiveMediaSource.Factory(mediaDataSourceFactory) |
OlderNewer