2015-11-04 105 views
1

我有list下载的加密文件视频,但他们不能被默认的Android播放器播放..我已经创建了我自己的播放器播放加密的视频。所以我想要的是,当用户点击加密的视频时,它弹出“完整的动作?”。然后他们选择所需的球员。我应该添加到我的播放器应用程序才能做到这一点?请帮助如何强制视频播放器的应用选择器?

我希望我的视频播放器出现在列表像this

这里是我获得选择的视频的路径下节课上,我如何获取路径?我希望玩家从我的下载中播放精确选择的视频。

import java.security.GeneralSecurityException; 

import javax.crypto.Cipher; 
import javax.crypto.spec.SecretKeySpec; 

/** 
* A PlayActivity variant that plays an encrypted video. 
*/ 
public class PlayActivity2 extends APlayActivity { 

    @Override 
    public Cipher getCipher() throws GeneralSecurityException { 
     final Cipher c = Cipher.getInstance("ARC4"); // NoSuchAlgorithmException, NoSuchPaddingException 
     c.init(Cipher.DECRYPT_MODE, new SecretKeySpec("BrianIsInTheKitchen".getBytes(), "ARC4")); // InvalidKeyException 
     return c; 
    } 

    @Override 
    public String getPath() { 



     return "THE SELECTED PATH OF THE ENCRYPTED VIDEO"; 
    } 
} 

回答

0

您可以尝试添加以下内容到

的manifest.xml

登记您的活动为视频播放器

<!-- Video player --> 
    <activity android:name=".APlayActivity" android:label="@string/app_name" 
     android:screenOrientation="sensorLandscape"> 
     <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
      <data android:scheme="rtsp" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <data android:mimeType="video/*" /> 
      <data android:mimeType="application/sdp" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
      <data android:scheme="http" /> 
      <data android:mimeType="video/*" /> 
     </intent-filter> 
    </activity> 
+0

如何获取所选视频的路径,以便它可以开始在播放器上播放。我希望它从这个方法返回public String getPath(){ directory。 返回“加密视频的选定路径”; } – Alex

0

你需要声明一个intent-filter你c处理您的视频文件格式,以便在您调用共享意图时调用您的播放器Activity播放视频。 例如,你可以在你的Mainfest.xml添加这样的事情在您的播放<activity>

<!-- This activity also handles "SEND" and "SEND_MULTIPLE" with media data --> 
<intent-filter> 
    <action android:name="android.intent.action.SEND"/> 
    <category android:name="android.intent.category.DEFAULT"/> 
    <data android:mimeType="video/*"/> 
</intent-filter> 

同时检查文档here下接受隐含意图。

+0

现在..好心如何获得所选视频的路径,以便它可以开始在播放器上播放。我希望它从这个方法返回public String getPath(){directory。返回“选定的加密路径 – Alex

+0

从列表中获得的文件在哪里? – M090009

相关问题