0

вызываю попап окно из главного активити, в нем VideoView. Вот как он создается

    var inflater: LayoutInflater  = holder.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
    var view = inflater.inflate(R.layout.popupfragment, null)
    val popupWindow = PopupWindow(view, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)
    val VideoClasser = VideoClasser(view, "asdasd", holder.context)
    VideoClasser.CreateVideo()
    TransitionManager.beginDelayedTransition(mLay)
    popupWindow.showAtLocation(mLay, Gravity.CENTER, 0, 0)

класс VideoClasser:

class VideoClasser(view: View, scr : String, base: Context) : ContextWrapper(base){//mb error

private var scres : String = ""
init {
     scres = scr
}
fun getSrc() : String{
    val Src : String = scres
    return Src
}
val Video : VideoView = view.findViewById(R.id.video)
val PauseButton: Button = view.findViewById(R.id.PauseButton)
fun StopPlay(view : View) {
    if (Video.isPlaying) {
        Video.pause()
        PauseButton.visibility = View.VISIBLE
    }
    else {
        Video.start()
        PauseButton.visibility = View.INVISIBLE
    }
}
 fun CreateVideo()  {
    val Src = scres
    Log.d("myVideo", Src)
    val scr : Uri = Uri.parse("https://www.dropbox.com/s/gys5q7yc868ko59/52586642_324829134816014_3179773492790820864_n.mp4?dl=1")
    Video.setOnClickListener(::StopPlay)
    PauseButton.setOnClickListener(::StopPlay)
    Video.setVideoURI(scr)
    Video.start()
}

}

сам VideoView:

<android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/someId"
            app:cardBackgroundColor="#FFF"
            android:visibility="invisible"
            android:layout_margin="50dp"
            app:cardCornerRadius="20dp">
        <VideoView
                android:id="@+id/video"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginBottom="50dp"
        />
</android.support.v7.widget.CardView>
2
  • А в логах что-то есть?
    – ЮрийСПб
    9 июн 2019 в 16:20
  • да, есть: 1) E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@[email protected]@[email protected]: Permission denied E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/data@[email protected]@[email protected]: Permission denied 2) E/RegisteredServicesCache: Aid Routing Table still availble , No need to disable services 3) E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
    – andrey
    9 июн 2019 в 18:07

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.