【问题标题】:Removal of YouTube Logo from an application using YouTube API in Android Studio在 Android Studio 中使用 YouTube API 从应用程序中删除 YouTube 徽标
【发布时间】:2018-04-11 05:39:57
【问题描述】:

如何在 Android Studio 中设计的应用中使用 YouTube API 从简单的嵌入式视频中删除 YouTube 徽标?

清单文件:

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.user.myyoutubeapp">

        <uses-permission android:name="android.permission.INTERNET" />

        <application


        android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name=".Next"></activity>
        </application>

    </manifest>`

XML 代码:

<?xml version="1.0" encoding="utf-8"?>
 <android.support.constraint.ConstraintLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <view
        android:id="@+id/view"
        class="com.google.android.youtube.player.YouTubePlayerView"
        id="@+id/myyoutubeapp"
        layout_marginTop="16dp"
        android:layout_width="match_parent"
        android:layout_height="380dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:text="Play"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/view" />


</android.support.constraint.ConstraintLayout>

I need to hide the marked logo from the embedded video

为了从上面设计的应用程序中删除 YouTube 徽标,可以进行哪些必要的更改。

【问题讨论】:

  • 使用嵌入链接,您可以使用“modestbranding”标志来隐藏 youtube 徽标。不确定这如何适用于 Android。例如:youtube.com/embed/video-link?modestbranding=1
  • 如何使用嵌入链接,因为在java代码文件中,只需要在youTubePlayer.loadVideo()命令中输入附加字符串值..!! @AnuraagBaishya

标签: android android-studio youtube


【解决方案1】:

您可以做的是使用 PlayerStyle.CHROMELESS 并且徽标将不可见。 youtubePlayer.setPlayerStyle(PlayerStyle.CHROMELESS) 但是你必须自己实现 youtube 播放器控件。

如有任何疑问,请告诉我。

【讨论】:

  • 非常感谢..!!是的,这确实有效.. !!但是,如果我想保留其他控件怎么办..?就像您也提到需要实现自己的 youtube 播放器控件一样,例如如何自己实现或设计控件?如果你能帮我解决这个问题,我会很棒..!!提前谢谢..!!
  • 您可以使用 youtubePlayer.play() 和 youtubePlayer.pause 轻松管理按钮点击事件上的播放暂停功能,并实现 seekbar 和 seekbars 进度更改实现 yoututbePlayer.seekToMillis((int)(youtubePlayer. getDurationMillis()*progress)/100)
  • @VibhorGupta 如果有帮助,请投票并接受答案。
  • @AmanRawat 我们可以将播放/暂停按钮和搜索栏放在视频上(就像 YouTube 一样)吗?
猜你喜欢
  • 1970-01-01
  • 2016-05-30
  • 2017-03-25
  • 1970-01-01
  • 1970-01-01
  • 2016-11-30
  • 2014-05-03
  • 2017-06-02
  • 1970-01-01
相关资源
最近更新 更多