Author: Nafiz

  • Android ExoPlayer with Fullscreen button

    Android ExoPlayer with Fullscreen button

    Android ExoPlayer

    ExoPlayer is an open-source media player for Android developed by Google. It is designed to be used as a replacement for the Android platform’s built-in media player, and it offers many advanced features such as dynamic adaptive streaming over HTTP (DASH), smooth streaming, and advanced audio playback. ExoPlayer is highly customizable, and it can be easily integrated into any Android app that needs to play audio or video content. It is also designed to be efficient and reliable, with a focus on low-latency playback and smooth audio and video performance. Overall, ExoPlayer is a powerful and versatile media player that offers a great deal of flexibility and control for developers.

    ExoSimplify

    ExoSimplify is an Android library that provides a simplified interface for using ExoPlayer, the open-source media player developed by Google. With ExoSimplify, developers can easily integrate ExoPlayer into their Android apps without having to worry about the complexity of the ExoPlayer API. ExoSimplify provides a set of simple methods that allow developers to quickly and easily play audio and video content using ExoPlayer, and it automatically handles many of the common tasks involved in using ExoPlayer, such as initializing and configuring the player, loading media sources, and displaying video content on the screen. By using ExoSimplify, developers can take advantage of the advanced features and capabilities of ExoPlayer without having to spend a lot of time and effort learning the details of the ExoPlayer API.

    How to install?

    To install ExoSimplify, you will need to add it as a dependency in your Android project.

    To do this, you will need to add the following lines to the dependencies section of your project’s build.gradle file:

    allprojects {
    	repositories {
    		maven { url 'https://jitpack.io' }
    	}
    }

    To do this, you will need to add the following lines to the dependencies section of your app’s build.gradle file:

    implementation 'com.github.sminrana:ExoSimplify:0.9.5'
    

    Once you have added this dependency to your project, you will need to sync your project with Gradle to download and install ExoSimplify. You can do this by clicking the “Sync Project with Gradle Files” button in the Android Studio toolbar. Once ExoSimplify has been installed, you can start using it in your project.

    Learn More About ExoSimplify on GitHub

    Spread the love
  • Generic in Swift

    Generic in Swift

    Generic in Swift

    In the Swift programming language, the term “generic” refers to a type or function that can work with any type, rather than being tied to a specific type. This allows for greater flexibility and code reuse. For example, a generic function can be written to sort an array of any type, rather than having to write a separate sorting function for each type of array. Using generics can make your code more concise and easy to read, and can help you avoid code duplication.

    Here is an example of a generic function in Swift that sorts an array of elements:

    func sortArray<T: Comparable>(array: [T]) -> [T] {
        let sortedArray = array.sorted()
        return sortedArray
    }
    

    In this example, the sortArray function is a generic function that can sort an array of any type that conforms to the Comparable protocol. This means that the function can sort arrays of integers, strings, or any other type that can be compared using the < and > operators.

    Here is how you could use this function to sort an array of integers:

    let numbers = [10, -1, 3, 9, 2]
    let sortedNumbers = sortArray(array: numbers)
    

    The sortedNumbers constant would be equal to [-1, 2, 3, 9, 10] after this code is executed.

    Spread the love
  • Extensions in Swift

    Extensions in Swift

    Extensions in Swift

    In Swift, an extension is a way to add new functionality to an existing class, structure, enumeration, or protocol type. This can include adding new methods, computed properties, and initializers, as well as providing new implementations of existing methods, properties, and subscripts. Extensions can be used to extend the functionality of any type, including built-in types, user-defined types, and even types defined in other libraries or frameworks.

    Here is an example of using an extension in Swift to add new functionality to an existing type:

    // Define a new Int type that represents a number of seconds
    typealias Seconds = Int
    
    // Define an extension on the Int type to add a new computed property
    extension Int {
        var minutes: Seconds {
            return self * 60
        }
    }
    
    // Use the new property to convert seconds to minutes
    let sixtySeconds = 1.minutes
    print(sixtySeconds)  // Output: 60
    

    In this example, we define a new typealias called Seconds to represent a number of seconds. We then define an extension on the Int type to add a new computed property called minutes. This property returns the number of seconds converted to minutes by multiplying the number of seconds by 60. Finally, we use the new minutes property to convert 1 second to minutes and print the result.

    Learn More

    Spread the love